Hi all,
I'm basically using code that is copy-pasted from CharacterDemo. How can I set a motionState for my character? Is there a way to find a rigid body that is associated with the character controller, or how else should I do this?
Thanks,
Kukanani
Using MotionState with CharacterController
-
- Posts: 107
- Joined: Fri Sep 19, 2008 6:08 pm
Re: Using MotionState with CharacterController
Hi
You mean the ghost object? That's what the character controller uses.
You mean the ghost object? That's what the character controller uses.
-
- Posts: 25
- Joined: Sat Feb 21, 2009 5:08 am
Re: Using MotionState with CharacterController
Ah, thanks.
Kukanani
Kukanani
-
- Posts: 25
- Joined: Sat Feb 21, 2009 5:08 am
Re: Using MotionState with CharacterController
Hey, I hate to revive this dead thread, but this just isn't working for me.
I have an Ogre3D entity that I want to follow the orientation of my btGhostObject. btGhostObject has no setMotionState method, and it also has no btRigidBody, which is the only way to set a MotionState. How do I do this?
Thanks,
Kukanani
I have an Ogre3D entity that I want to follow the orientation of my btGhostObject. btGhostObject has no setMotionState method, and it also has no btRigidBody, which is the only way to set a MotionState. How do I do this?
Thanks,
Kukanani
-
- Posts: 18
- Joined: Sun Mar 29, 2009 5:00 pm
Re: Using MotionState with CharacterController
btGhostObject just checks for collisions using its shape, so it has a static rotation if I'm right?Kukanani wrote:Hey, I hate to revive this dead thread, but this just isn't working for me.
I have an Ogre3D entity that I want to follow the orientation of my btGhostObject. btGhostObject has no setMotionState method, and it also has no btRigidBody, which is the only way to set a MotionState. How do I do this?
Thanks,
Kukanani
btGhostObject and btRigidBody both derive from btCollisionObject, which has the methods getWorldTransform() and setWorldTransform(). You can set the position using m_ghostObject->getWorldTransform().setOrigin( btVector3(m_ogrePosition.X, m_ogrePosition.Y, m_ogrePosition.Z) ). You can get the position using m_ghostObject->getWorldTransform().getOrigin() which returns a btVector3.
-
- Posts: 133
- Joined: Wed Jul 27, 2005 1:05 pm
- Location: Berkeley, CA
Re: Using MotionState with CharacterController
Hi,
btMotionState is currently only available for rigid bodies. You can always manually synchronize your graphics transformation with one obtained from the character controller.
As Sorlaize said, you can use getWorldTransform() to obtain the current transformation of the btGhostObject.
HTH,
John
btMotionState is currently only available for rigid bodies. You can always manually synchronize your graphics transformation with one obtained from the character controller.
As Sorlaize said, you can use getWorldTransform() to obtain the current transformation of the btGhostObject.
HTH,
John
-
- Posts: 25
- Joined: Sat Feb 21, 2009 5:08 am
Re: Using MotionState with CharacterController
Ah, thanks, that does it.
Kukanani
Kukanani