Exemplo n.º 1
0
void ROC::Collision::SetPosition(const glm::vec3 &f_pos)
{
    if(m_rigidBody)
    {
        btTransform l_transform;
        switch(m_motionType)
        {
            case CMT_Default: case CMT_Static:
                l_transform = m_rigidBody->getCenterOfMassTransform();
                break;
            case CMT_Kinematic:
                m_rigidBody->getMotionState()->getWorldTransform(l_transform);
                break;
        }
        btVector3 l_pos(f_pos.x, f_pos.y, f_pos.z);
        l_transform.setOrigin(l_pos);
        switch(m_motionType)
        {
            case CMT_Default: case CMT_Static:
                m_rigidBody->setCenterOfMassTransform(l_transform);
                break;
            case CMT_Kinematic:
                m_rigidBody->getMotionState()->setWorldTransform(l_transform);
                break;
        }
        m_rigidBody->activate(true);
    }
}
Exemplo n.º 2
0
bool ECS_Entity_Loader::mt_Load_Position(const XML_Element& position)
{
	bool l_b_ret(true);
	sf::Vector2f l_pos(-500.0f, -500.0f);
	int l_z(-1);

	ComponentPosition* l_position = m_target->mt_Add_Component<ComponentPosition>(m_entity_id, ECS_ComponentId::POSITION);

	l_position->mt_Set_Current_Position(l_pos, l_z);

	return l_b_ret;
}