How to implement own character controller?

cebugdev
Posts: 15
Joined: Fri Nov 19, 2010 8:58 am

How to implement own character controller?

Post by cebugdev »

Hi all,

how to implement custom character controller using rigid body?
we are having problem with current bullet kinematic character controller (for weeks now)because it does not give the impulse during collision, it always returns 0.

In fact i already posted 3 threads about that on this forum. Our management decides to dump bullet library completely but i convinced them to give bullet's a chance,
therefore maybe i can implement our own character controller that detects the impulse during collision correctly, by doing some testing i found out that rigid bodies can indeed detect collision impulse correctly therefore maybe i can implement character controller using this.

SO how do i implement my own character controller using rigid bodies with feature such as "collide and slide"
Can you guys help me?
Or maybe anyone has already implemented this and perhaps is willing to share thier source.
please we need your help, our project was stucked because of this issue.

Thanks.
Mako_energy02
Posts: 171
Joined: Sun Jan 17, 2010 4:47 am

Re: How to implement own character controller?

Post by Mako_energy02 »

I personally have never used the btKinematicCharacterController class, but I do have a few idea's of how you may be able to get the information. But first I need to know where you are getting the impulse info from currently. Any chance you can post some code?
bimmy47
Posts: 6
Joined: Thu May 26, 2011 8:36 pm

Re: How to implement own character controller?

Post by bimmy47 »

Hi,
I may be incorrect, but I believe the reason you could not get the collison impulse for your btKinematicCharacterController is that the Kinematic Character Controller is a kinematic object only. Other objects may be "pushed" by it, but it is not affected by any collisions (in order to facilitate walking/running/jumping normally). Thus, it is not designed to receive an impulse from any collisions (again, I think). You can still use it for a normal player character object, where user input drives the motion, and then if the character needs to become collide-able temporarily (for ragdoll motion etc...) then just sub out the character controller for a standard body. Or, start from scratch with your own rigid body controller class. Really, there doesn't seem to be much code for the btKinematicCharacterController, and I've read there are still quite a few bugs, so you might be better off. Then again, you should probably be familiar with bullet before attempting it. :?
cebugdev
Posts: 15
Joined: Fri Nov 19, 2010 8:58 am

Re: How to implement own character controller?

Post by cebugdev »

Mako_energy02 wrote:I personally have never used the btKinematicCharacterController class, but I do have a few idea's of how you may be able to get the information. But first I need to know where you are getting the impulse info from currently. Any chance you can post some code?
Right now im getting the impulse value by using the tutorial specified on this link;
'Contact Information' information tutorial

http://bulletphysics.org/mediawiki-1.5. ... d_Triggers
bimmy47 wrote:Hi,
I may be incorrect, but I believe the reason you could not get the collison impulse for your btKinematicCharacterController is that the Kinematic Character Controller is a kinematic object only. Other objects may be "pushed" by it, but it is not affected by any collisions (in order to facilitate walking/running/jumping normally). Thus, it is not designed to receive an impulse from any collisions (again, I think). You can still use it for a normal player character object, where user input drives the motion, and then if the character needs to become collide-able temporarily (for ragdoll motion etc...) then just sub out the character controller for a standard body. Or, start from scratch with your own rigid body controller class. Really, there doesn't seem to be much code for the btKinematicCharacterController, and I've read there are still quite a few bugs, so you might be better off. Then again, you should probably be familiar with bullet before attempting it. :?
If i Implement my own rigidbody controller class,
Anyone has an idea on how can i do 'collide and slide' just like the other games using rigid body?
Mako_energy02
Posts: 171
Joined: Sun Jan 17, 2010 4:47 am

Re: How to implement own character controller?

Post by Mako_energy02 »

Well you are pretty much getting the impulse value from the right place, only other thing I can think to try and tampering with it's collision flags. Something to the effect of:

Code: Select all

m_GhostObject->setCollisionFlags(m_GhostObject->getCollisionFlags() - btCollisionObject::CF_NO_CONTACT_RESPONSE);
See if that makes it start making those values. But as I understand it that isn't how they are *meant* to be used, so I'm not sure what all consequences there would be to doing this even if it worked.

Good luck.