Hi
Please see screen shot:
This is the mesh that i loaded in btBvhTriangleMeshShape.
The kinematic character controller does collide but it does not slide. It gets stuck. Any ideas?
Thanks in advance.
kinematic character controller demo not sliding
-
- Posts: 107
- Joined: Fri Sep 19, 2008 6:08 pm
-
- Posts: 144
- Joined: Fri Aug 01, 2008 6:36 am
- Location: Bonn, Germany
Re: kinematic character controller demo not sliding
Hello,
may be preStep and playerStep functions are not called? Just guessing.
In actual examples it is done with PlayerStepCallback callback function.
The function has to be registered with
m_dynamicsWorld->setInternalTickCallback(PlayerStepCallback, m_character);
Alternatively you could try to put preStep and playerStep calls somewhere in
your "step physic" function directly. It works too (may be it is not a good idea, don't know,
just to test). One more thing - custom overlapping pair class is used in examples. It makes things little more difficult to start with controller (but gives good starting point for advanced things). I have tried controller simply without it - works too. Have tested on bvh mesh ground and static plane. The character is running staircases up and down very well.
may be preStep and playerStep functions are not called? Just guessing.
In actual examples it is done with PlayerStepCallback callback function.
The function has to be registered with
m_dynamicsWorld->setInternalTickCallback(PlayerStepCallback, m_character);
Alternatively you could try to put preStep and playerStep calls somewhere in
your "step physic" function directly. It works too (may be it is not a good idea, don't know,
just to test). One more thing - custom overlapping pair class is used in examples. It makes things little more difficult to start with controller (but gives good starting point for advanced things). I have tried controller simply without it - works too. Have tested on bvh mesh ground and static plane. The character is running staircases up and down very well.
-
- Posts: 107
- Joined: Fri Sep 19, 2008 6:08 pm
Re: kinematic character controller demo not sliding
thanks for trying to help out.
strange that when i add a collision margin on the btBvhTriangleMeshShape proportion(large enough) to my character shape size, it will now slide accordingly with the walls.
Any ideas? In my screenshot, i needed to add 0.5 to the collision margin for the character to slide properly.
strange that when i add a collision margin on the btBvhTriangleMeshShape proportion(large enough) to my character shape size, it will now slide accordingly with the walls.
Any ideas? In my screenshot, i needed to add 0.5 to the collision margin for the character to slide properly.
-
- Posts: 144
- Joined: Fri Aug 01, 2008 6:36 am
- Location: Bonn, Germany
Re: kinematic character controller demo not sliding
I think i understand your problem now - character stick to walls and (probably hangs over the ground at stepHeight). I run into the problem too... So you have helped me There is hidden code in stepForwardAndStrafe function about collision margin (near collisionWorld->convexSweepTest(), seems to help.
-
- Posts: 107
- Joined: Fri Sep 19, 2008 6:08 pm
Re: kinematic character controller demo not sliding
yeah it sticks to the walls. my level is flat so i don't encounter the problem with step up/down.
Thanks very much for the info I'll go check that portion of code out as well. Definitely its nice to modify that part instead of the entire btBvhTriangleMeshShape as all other bodies have that collision margin applied to them as well.
Do let me know if you manage to find out the correct fix for this.
Thanks very much for the info I'll go check that portion of code out as well. Definitely its nice to modify that part instead of the entire btBvhTriangleMeshShape as all other bodies have that collision margin applied to them as well.
Do let me know if you manage to find out the correct fix for this.
-
- Posts: 107
- Joined: Fri Sep 19, 2008 6:08 pm
Re: kinematic character controller demo not sliding
apparently it did not help on my part.
Did it help on your part? did just uncomment the code? I tried changing the values too didn't help.
Did it help on your part? did just uncomment the code? I tried changing the values too didn't help.
-
- Posts: 144
- Joined: Fri Aug 01, 2008 6:36 am
- Location: Bonn, Germany
Re: kinematic character controller demo not sliding
Yes, it helped, the character dosn't stick. I have changed the value to +0.1
btScalar margin = m_shape->getMargin();
m_shape->setMargin(margin + 0.1f);
collisionWorld->convexSweepTest (m_shape, start, end, callback);
m_shape->setMargin(margin);
btScalar margin = m_shape->getMargin();
m_shape->setMargin(margin + 0.1f);
collisionWorld->convexSweepTest (m_shape, start, end, callback);
m_shape->setMargin(margin);
-
- Posts: 107
- Joined: Fri Sep 19, 2008 6:08 pm
Re: kinematic character controller demo not sliding
thanks mi, it works now. silly mistake on my part earlier.