• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TransformComponent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中TransformComponent的典型用法代码示例。如果您正苦于以下问题:C++ TransformComponent类的具体用法?C++ TransformComponent怎么用?C++ TransformComponent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TransformComponent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: addModel

Actor* addModel(string filename, vec3 pos = vec3(0), vec3 s = vec3(1))
{

	Actor* sphere = new Actor;

	TransformComponent* trans = new TransformComponent();
	trans->setPos(pos);

	trans->setScale(s);
	sphere->addComponent(trans);
	glDebug();
	sphere->addComponent(new StaticMeshStaticPhysicsComponent(AssetManager::getBasePath() + filename));
	glDebug();
	MeshGraphicComponent* mesh = new MeshGraphicComponent(AssetManager::getBasePath() + filename);
	glDebug();
	mesh->setTextureMatrix(mat2(scale(mat4(1), vec3(10))));
	glDebug();
	Material *mat = new Material();
	glDebug();
	mat->setDiffuse(AssetManager::getBasePath() + "Data/Texture/floor1_d.png");
	mat->setNormal(AssetManager::getBasePath() + "Data/Texture/floor1_n.png");
	mat->setSpecular(AssetManager::getBasePath() + "Data/Texture/floor1_s.png");
	mat->setShininess(20);
	glDebug();
	mesh->addMaterial(mat);
	glDebug();
	sphere->addComponent(mesh);
	glDebug();
	return sphere;
}
开发者ID:ennioquaglia,项目名称:GameEngine,代码行数:30,代码来源:main.cpp


示例2:

	math::Vec3 TransformComponent::getPosition()
	{
		// Go trough parents and add transform from those to this.

		// Current entity
		Entity *ent = (Entity*)getParent();

		if (ent == NULL)
			return position;

		// Get current entities parent
		Entity *parent = ent->getParentEntity();

		if (parent == NULL)
			return position;

		TransformComponent *parentTransform = parent->findComponent<TransformComponent>();

		if (parentTransform == NULL)
			return position;

		//TODO: Add parenting to the rotation

		return parentTransform->getPosition() + position;
	}
开发者ID:LauriM,项目名称:PropellerEngine,代码行数:25,代码来源:TransformComponent.cpp


示例3: addMap

Actor* addMap()
{
	Actor* sphere = new Actor;

	TransformComponent* trans = new TransformComponent();

	trans->setPos(vec3(0, -0.01, 0));
	Rotation rot;
	rot.setEulerAngles(vec3(0, 0.785, 0));
	trans->setRotation(rot);
	sphere->addComponent(trans);
	glDebug();
	sphere->addComponent(new StaticMeshStaticPhysicsComponent(AssetManager::getBasePath() + "Data/Model/mappa4.obj"));
	glDebug();
	MeshGraphicComponent* mesh = new MeshGraphicComponent(AssetManager::getBasePath() + "Data/Model/mappa4.obj");
	glDebug();
	mesh->setTextureMatrix(mat2(scale(mat4(1), vec3(10))));
	glDebug();
	Material *mat = new Material();
	glDebug();
	mat->setDiffuse(AssetManager::getBasePath() + "Data/Texture/floor1_d.png");
	mat->setNormal(AssetManager::getBasePath() + "Data/Texture/floor1_n.png");
	mat->setSpecular(AssetManager::getBasePath() + "Data/Texture/floor1_s.png");
	mat->setShininess(20);
	glDebug();
	mesh->addMaterial(mat);
	glDebug();
	sphere->addComponent(mesh);
	glDebug();
	return sphere;
}
开发者ID:ennioquaglia,项目名称:GameEngine,代码行数:31,代码来源:main.cpp


示例4: PxMatrixToMat4x4

void PhysXPhysics::VSyncVisibleScene()
{
	for (ActorIdToPysXRigidBodyTable::const_iterator it = m_actorRigidBodyMap.begin(); it != m_actorRigidBodyMap.end(); it++)
	{
		ActorId const id = it->first;

		PxTransform pxLoc = it->second->getGlobalPose();
		Mat4x4 loc;
		PxMatrixToMat4x4(PxMat44(pxLoc), &loc);
		
		Actor* pActor = g_pApp->m_pGame->VGetActor(id);
		if (pActor)
		{
			TransformComponent* pTransformComponent = pActor->GetComponent<TransformComponent>(TransformComponent::g_Name);

			if (pTransformComponent)
			{
				if (pTransformComponent->GetTransform() != loc)
				{
					Vec3 rot = loc.GetYawPitchRoll();
					pTransformComponent->SetPosition(loc.GetPosition());
					pTransformComponent->SetRotation(Vec3(XMConvertToDegrees(rot.x), XMConvertToDegrees(rot.y), XMConvertToDegrees(rot.z)));
					EventDataPtr pEvent(BE_NEW EvtData_Move_Actor(id, loc));
					IEventManager::Get()->VQueueEvent(pEvent);
				}
			}
		}
	}
}
开发者ID:jel-massih,项目名称:BombastEngine,代码行数:29,代码来源:PhysXPhysics.cpp


示例5: draw

void RenderSystem::draw(GameObject* gameObject)
{
	RenderComponent* render = gameObject->getComponent<RenderComponent>();
	if (render != nullptr)
	{
		RectangleShape shape = *render->getDrawable();

		TransformComponent* transform = gameObject->getComponent<TransformComponent>();
		if (transform != nullptr)
		{
			shape.setPosition(transform->getPosition());
		}
		else
		{
			BoardComponent* boardComp = gameObject->getComponent<BoardComponent>();
			if (boardComp != nullptr && mBoard != nullptr)
			{
				Vector2i boardPos = boardComp->getPosition();
				shape.setPosition(mBoard->getTilePosition(boardPos.x, boardPos.y));
			}
		}

		mWindow->draw(shape);
	}
}
开发者ID:tuomoO,项目名称:Ristinolla,代码行数:25,代码来源:RenderSystem.cpp


示例6:

//Busca enemigos
void CameraController3rd::lookForEnemies()
{
	std::map<Entity*,Component*>* entitiesWithED = EntityManager::get().getAllEntitiesPosessingComponent<EnemyDataComponent>();
	if(!entitiesWithED) return;

	float distance = FLT_MAX;
	float min_distance = distance;

	std::map<Entity*,Component*>::iterator iter;
	for (iter = entitiesWithED->begin(); iter != entitiesWithED->end(); ++iter)
	{
		if( iter->second->enabled ) 
		{
			Entity* entity = iter->first;
			TransformComponent* transformEnemy = EntityManager::get().getComponent<TransformComponent>(entity);
			
			float angle = _front.angle(transformEnemy->getPosition() - _camera->getPosition());

			//dbg("angle: %f\n", angle);
		
			if( angle < 1.0f )
			{		
				distance = transformEnemy->getPosition().distance2(_camera->getTarget());
				//dbg("distance: %f\n", distance);
				
				if(distance < 30.0f && distance < min_distance)
				{	
					_lockedEntity = entity;
					min_distance = distance;
				}
			}			
		}
	}
}
开发者ID:xDavidLeon,项目名称:pathofshadowsprototype,代码行数:35,代码来源:camera_controller_3rd.cpp


示例7: addAxis3

Actor* addAxis3()
{
	Actor* actor = new Actor;

	TransformComponent* trans = new TransformComponent();
	trans->setPos(vec3(-5, 0, 5));

	Rotation rot;
	rot.setNormalDirection(vec3(1, 0, 0));
	trans->setRotation(rot);

	actor->addComponent(trans);
	MeshGraphicComponent* mesh = new MeshGraphicComponent(AssetManager::getBasePath() + "Data/Model/axis.obj");
	Material *mat = new Material();
	mat->setDiffuse("#FF0000");
	mesh->addMaterial(mat);
	Material *mat1 = new Material();
	mat1->setDiffuse("#00FF00");
	mesh->addMaterial(mat1);
	mesh->addMaterial(mat1);
	Material *mat2 = new Material();
	mat2->setDiffuse("#0000FF");
	mesh->addMaterial(mat2);
	actor->addComponent(mesh);
	return actor;
}
开发者ID:ennioquaglia,项目名称:GameEngine,代码行数:26,代码来源:main.cpp


示例8: Update

void BulletScript::Update(GameEngine *game)
{
	TransformComponent *transform = this->gameObject->GetComponent<TransformComponent*>();
	transform->move(20, 0);	
	for (std::vector<GameObject*>::iterator it = this->gameObject->gameScene->gameObjects.begin(); it != this->gameObject->gameScene->gameObjects.end(); it++)
	{
		ColliderComponent *thisObject = this->gameObject->GetComponent<ColliderComponent*>();
		if ((*it)->getName() == "enemy")
		{			
			ColliderComponent *anotherObject = (*it)->GetComponent<ColliderComponent*>();			
			if (anotherObject != NULL && thisObject != anotherObject)
			{			
				//std::cout << anotherObject->getX();
				if (thisObject->getX() + thisObject->getWidth() >= anotherObject->getX() && thisObject->getX() <= anotherObject->getX() + anotherObject->getWidth()
					&& thisObject->getY() + thisObject->getHeight() >= anotherObject->getY() && thisObject->getY() <= anotherObject->getY() + anotherObject->getHeight())
				{					
					(*it)->setEnable(false);
					//BulletScript::SCORE++;
					//std::cout << BulletScript::SCORE++;
					/*
					score_ = db->load_int_data("pontos");
					db->save_data("pontos", score_++, 0, 0);					
					TextComponent * text = this->gameObject->GetComponent<TextComponent*>();					
					text->set_string(std::string("score: " + score_));*/
					(*score)++;
				}
			}

		}
	}
}
开发者ID:runewather,项目名称:SFMLGameFramework,代码行数:31,代码来源:BulletScript.cpp


示例9:

	void
	CollisionComponent::Update(GameObject& gameObject, double)
	{
		TransformComponent *transform = static_cast<TransformComponent*>(gameObject.FilterComponent("Transform").front().get());
		SDL_Rect pos = transform->GetPosition();

		this->_collider->SetPosition(Vector2D((float)pos.x, (float)pos.y));
	}
开发者ID:teemitzitrone,项目名称:Chase-the-Shadow,代码行数:8,代码来源:CollisionComponent.cpp


示例10: while

void PlayerControllerSubsystem::process(unsigned int dt)
{
    ALLEGRO_EVENT ev;
    while (events.get(&ev))
    {
        if (ev.type == ALLEGRO_EVENT_KEY_DOWN)
        {
            switch (ev.keyboard.keycode)
            {
                case ALLEGRO_KEY_W: button_states[MOVE_FORWARD] = true; break;
                case ALLEGRO_KEY_A: button_states[ROTATE_LEFT] = true; break;
                case ALLEGRO_KEY_S: button_states[MOVE_BACKWARD] = true; break;
                case ALLEGRO_KEY_D: button_states[ROTATE_RIGHT] = true; break;
            }
        }
        else if (ev.type == ALLEGRO_EVENT_KEY_UP)
        {
            switch (ev.keyboard.keycode)
            {
                case ALLEGRO_KEY_W: button_states[MOVE_FORWARD] = false; break;
                case ALLEGRO_KEY_A: button_states[ROTATE_LEFT] = false; break;
                case ALLEGRO_KEY_S: button_states[MOVE_BACKWARD] = false; break;
                case ALLEGRO_KEY_D: button_states[ROTATE_RIGHT] = false; break;
            }
        }
    }

    for (std::set<Entity>::const_iterator iter = active.begin(); iter != active.end(); iter++)
    {
        TransformComponent *tc = world->get<TransformComponent>(*iter);

        static const float max_speed = 0.3;
        if (tc->velocity.squaredNorm() > max_speed * max_speed)
        {
            tc->velocity *= 1 / tc->velocity.norm() * max_speed;
        }

        if (button_states[MOVE_FORWARD])
        {
            tc->acceleration(0) += cos(tc->rotation) / 1000;
            tc->acceleration(1) += sin(tc->rotation) / 1000;
        }
        if (button_states[MOVE_BACKWARD])
        {
            tc->acceleration(0) -= cos(tc->rotation) / 1000;
            tc->acceleration(1) -= sin(tc->rotation) / 1000;
        }

        if (button_states[ROTATE_LEFT])
        {
            tc->rotation += 0.1;
        }
        if (button_states[ROTATE_RIGHT])
        {
            tc->rotation -= 0.1;
        }
    }
}
开发者ID:raphtown,项目名称:sputnik,代码行数:58,代码来源:player_controller_subsystem.cpp


示例11: update

void PhysComponent::update()
{
	if (m_Obj->hasComponent("Transform")) {
		TransformComponent* tc = (TransformComponent*)m_Obj->getComponent("Transform");
		b2Vec2 pos = m_Body->GetPosition();
		tc->setPosition((double)pos.x, (double)pos.y);
		tc->setRotation( m_Body->GetAngle() * (180.0f / (float)Gosu::pi));
	}
}
开发者ID:ChadyG,项目名称:MUGE,代码行数:9,代码来源:SceneObject.cpp


示例12: JunctionQueue

JunctionQueue *GraphicSystem::Process(Entity *entity) {
	TransformComponent *transform = (TransformComponent*)(entity->GetComponent(Component::ComponentType::Transform));
	GraphicsComponent *graphics = (GraphicsComponent*)(entity->GetComponent(Component::ComponentType::Graphics));
	
	graphics->SetPos(transform->GetX(), transform->GetY());
	graphics->SetRotation(transform->GetRotation());
	graphics->Draw(_window);

	return new JunctionQueue();
}
开发者ID:ScottWe,项目名称:Component-Engine,代码行数:10,代码来源:GraphicSystem.cpp


示例13: update

	void update() {

		if(win->inputManager->isKeyPressed(GLFW_KEY_F2)) {
			scene->addActor(addSphereLight());
		}
		if(win->inputManager->isKeyPressed(GLFW_KEY_F3)) {
			TransformComponent* trans = mainchar->getComponent<TransformComponent>(ComponentId::Transform);
			Debug(trans->getPos());
		}

	}
开发者ID:ennioquaglia,项目名称:GameEngine,代码行数:11,代码来源:main.cpp


示例14: BE_ASSERT

void PhysXPhysics::AddShape(Actor* pActor, PxGeometry* geometry, float density, const std::string& physicsMaterial, bool gravityEnabled, float linearDamping, float angularDamping, const std::string& bodyType)
{
	BE_ASSERT(pActor);
	ActorId actorId = pActor->GetId();
	BE_ASSERTf(m_actorRigidBodyMap.find(actorId) == m_actorRigidBodyMap.end(), "Actor with more than one rigidbody");

	Mat4x4 transform = Mat4x4::g_Identity;
	
	TransformComponent* pTransformComponent = pActor->GetComponent<TransformComponent>(TransformComponent::g_Name);

	if (pTransformComponent)
	{
		transform = pTransformComponent->GetTransform();
	}
	else 
	{
		//Doesnt work without transform
		BE_ERROR("Actor %s PhysicsComponent requires Shape to have Transform Component: %d", actorId);
		return;
	}

	PhysicsMaterialData material(LookupMaterialData(physicsMaterial));
	PxMaterial* mat = m_pPhysicsSdk->createMaterial(material.m_friction, material.m_friction, material.m_restitution);

	Vec3 translation, scale;
	Quaternion rotation;
	
	bool ok = transform.Decompose(translation, rotation, scale);
	PxQuat pxRot;
	PxVec3 pxLoc;
	Vec3ToPxVec(translation, &pxLoc);
	QuaternionToPxQuat(rotation, &pxRot);
	PxTransform t(pxLoc, pxRot);

	if (bodyType == "Dynamic")
	{
		PxRigidDynamic* body = PxCreateDynamic(*m_pPhysicsSdk, t, *geometry, *mat, density);
		body->setActorFlag(PxActorFlag::eDISABLE_GRAVITY, !gravityEnabled);
		PxRigidBodyExt::updateMassAndInertia(*body, density);
		body->setLinearDamping(linearDamping);
		body->setAngularDamping(angularDamping);
		m_pScene->addActor(*body);

		m_actorRigidBodyMap[actorId] = body;
		m_rigidBodyActorMap[body] = actorId;
	}
	else
	{
		BE_ERROR("[Physics] BodyType not supported: %s", bodyType.c_str());
		return;
	}
}
开发者ID:jel-massih,项目名称:BombastEngine,代码行数:52,代码来源:PhysXPhysics.cpp


示例15: InitializeTransformComponent

    bool InitializeTransformComponent(IActorComponent* cmp, ICMStream* stream)
    {
        TransformComponent* transformation = (TransformComponent*)cmp;
        tinyxml2::XMLElement* pData = (tinyxml2::XMLElement*)stream;
        tinyxml2::XMLElement* trans = pData->FirstChildElement("Position");

        if(trans)
        {
            float x, y, z;
            RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != trans->QueryFloatAttribute("x", &x));
            RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != trans->QueryFloatAttribute("y", &y));
            RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != trans->QueryFloatAttribute("z", &z));
            transformation->GetTransformation()->Translate(x, y, z);
        }

        tinyxml2::XMLElement* rot = pData->FirstChildElement("Rotation");

        if(rot)
        {
            float x, y, z, w;
            RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != rot->QueryFloatAttribute("x", &x));
            RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != rot->QueryFloatAttribute("y", &y));
            RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != rot->QueryFloatAttribute("z", &z));
            RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != rot->QueryFloatAttribute("w", &w));
            transformation->GetTransformation()->SetRotateQuat(x, y, z, w);
        }

        rot = pData->FirstChildElement("AxisAngle");

        if(rot)
        {
            float x, y, z, w;
            RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != rot->QueryFloatAttribute("x", &x));
            RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != rot->QueryFloatAttribute("y", &y));
            RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != rot->QueryFloatAttribute("z", &z));
            RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != rot->QueryFloatAttribute("w", &w));
            transformation->GetTransformation()->SetRotation(util::Vec3(x, y, z), w);
        }

        tinyxml2::XMLElement* scale = pData->FirstChildElement("Scale");

        if(scale)
        {
            float x, y, z;
            RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != scale->QueryFloatAttribute("x", &x));
            RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != scale->QueryFloatAttribute("y", &y));
            RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != scale->QueryFloatAttribute("z", &z));
            transformation->GetTransformation()->SetScale(x, y, z);
        }
        
        return true;
    }
开发者ID:moresascha,项目名称:Chimera,代码行数:52,代码来源:ComponentInitializer.cpp


示例16: getOwner

void FullbrightMaterialComponent::onRender()
{
	if(!hasModelData()) {
		return;
	}
	
	const CameraComponent &cam				= getOwner().getCameraManager().getCurrentCamera();
	//const TransformComponent *camTransform  = cam.getOwner()->getComponent<TransformComponent>();
	TransformComponent *transform			= getOwner().getComponent<TransformComponent>();
	assert(transform);
	
	CaffMath::Matrix44 worldMat = transform->getWorldMatrix();
	glm::mat4 wMat;
	
	memcpy(&wMat[0][0], &worldMat._11, sizeof(float) * 16);
	
//	const glm::mat4 pMat  = cam.getProjMatrix();
//	
//	CaffMath::Matrix44 viewMat = camTransform->getWorldMatrix();
//	glm::mat4 vMat;
//	const glm::mat4 vMat2 = cam.getViewMatrix();
//	
//	memcpy(&vMat[0][0], &viewMat._11, sizeof(float) * 16);
//	
//	//vMat = vMat._inverse();
//	vMat = vMat2;

	const glm::mat4 wvpMat = cam.getViewProjMatrix() * wMat;
	
	CaffApp::Renderer &renderer = getOwner().getRenderer();
	
	renderer.reset();
	renderer.setShader(fullBrightShaderID);
	renderer.setVertexFormat(fullBrightVertexID);
	renderer.setTexture("diffuseTex", m_diffuseMapID);
	renderer.setShader2f("texScale", &m_diffuseScale.x);
	renderer.setShaderMatrix44f("wvpMat", &wvpMat[0][0]);
	renderer.setShader4f("color", &m_rgba.x);
	
	for(std::size_t i = 0; i < getModelData()->model->getNumberOfMeshes(); ++i)
	{
		renderer.setVertexBuffer(getModelData()->vertBufferIDs.at(i));
		
		if(getModelData()->indexBufferIDs.size() < i)
		{
			renderer.setIndexBuffer(getModelData()->indexBufferIDs.at(i));
		}
		
		renderer.apply();
		renderer.drawArray(CaffApp::Primitive::TRIANGLES, 0, getModelData()->model->getMesh(i).getGLFaces());
	}
}
开发者ID:PhilCK,项目名称:vortex,代码行数:52,代码来源:MaterialComponent.cpp


示例17: update

void SpriteComponent::update() 
{
	// setting position from Transform Component
	TransformComponent* transform = parent.getComponent<TransformComponent>();
 	
	sprite.setPosition(utils::mToPx(transform->getX()),
	                   utils::mToPx(transform->getY()) );

	sprite.setRotation(utils::radToDeg(transform->getRotation()) );
	
	GameManager& gameManager = GameManager::getInstance();
	gameManager.getWindow().draw(sprite);
}
开发者ID:czeslavo,项目名称:magpie,代码行数:13,代码来源:SpriteComponent.cpp


示例18: sendCamInformation

void CameraComponent::sendCamInformation( GeneralGlWindow * window )
{
	glm::vec3 from = glm::vec3();
	glm::vec3 to = glm::vec3(1,0,0);
	glm::vec3 up = glm::vec3(0,1,0);
	TransformComponent * trans = parent->getComponent<TransformComponent>();
	if( trans != nullptr )
	{
		from = glm::vec3( trans->getTransformation() * glm::vec4( from, 1 ) );
		to = glm::vec3( trans->getTransformation() * glm::vec4( to, 1 ) );
		up = glm::vec3( trans->getRotationMatrix() * glm::vec4( up, 1 ) );
	}
	glm::mat4 camcam = glm::perspective(fov, aspect, camNear, camFar) * glm::lookAt( from, to, up );
	window->setUniformParameter( "mvp", GeneralGlWindow::PT_MAT4, (float*)&camcam );
}
开发者ID:JonECG,项目名称:Cpp-Game-Engine,代码行数:15,代码来源:CameraComponent.cpp


示例19: GetTransformComponent

 Quat TransformComponent::GetOrientation(bool Relative) const
 {
     //Entity* P = m_Entity->GetParent();
     Quat Orientation = m_Orientation;
     if(m_HasParent) {
         TransformComponent* t = (TransformComponent*)m_RelativeTo->GetComponentByType(CT_TRANSFORM);
         if(t) Orientation *= t->GetOrientation(Relative);
     }
     /*if(P && !Relative && m_InheritOrientation)
     {
         TransformComponent* t = GetTransformComponent(P);
         if(t) Orientation *= t->GetOrientation(Relative);
         P->Destroy();
     }*/
     return Orientation;
 }
开发者ID:mdecicco,项目名称:SandboxSimulator2014,代码行数:16,代码来源:TransformComponent.cpp


示例20: CircleCollider

	CollisionComponent*
	CollisionComponent::Factory(GameObject &gameObject, Collider *collider)
	{
		if (nullptr == collider)
		{
			TransformComponent *transform = static_cast<TransformComponent*>(gameObject.FilterComponent("Transform").front().get());
			SDL_Rect pos = transform->GetPosition();
			SDL_Rect *scale = transform->GetScale();
			collider = new CircleCollider(Vector2D((float)pos.x, (float)pos.y), (scale->h/2));
		}

		CollisionComponent *collisionComponent = new CollisionComponent(collider);
		gameObject.RegisterComponent(Component(new CollisionComponent(collider)));

		return collisionComponent;
	}
开发者ID:teemitzitrone,项目名称:Chase-the-Shadow,代码行数:16,代码来源:CollisionComponent.cpp



注:本文中的TransformComponent类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TransformKeyFrame类代码示例发布时间:2022-05-31
下一篇:
C++ Transform3f类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap