Code: Select all
MotionState::MotionState(object *_object) : m_pObject(object)
{
float x = m_pObject->getPosition().x;
float y = m_pObject->getPosition().y;
float z = m_pObject->getPosition().z;
float qx = m_pObject->getRotation().q.x;
float qy = m_pObject->getRotation().q.y;
float qz = m_pObject->getRotation().q.z;
float qw = m_pObject->getRotation().q.w;
btTransform transform;
transform.setIdentity();
transform.setOrigin({ x, y, z });
transform.setRotation({ qx, qy, qz, qw });
m_Pos1 = transform;
}
The code worked (objects showed and moved) when I didnt set the rotation (ie I just set the origin or location).
How would I go about setting the initial rotation of the object? I am using motionstates and read in one of the manuals this was the way to do it, but I can't figure out how to set the rotation.