Let's make Character Controller better.

ihar3d
Posts: 25
Joined: Wed Jan 23, 2008 11:28 am

Let's make Character Controller better.

Post by ihar3d »

Hello All!

Unfortunately current Bullet's character controller is not so good as can be.
There are no:
1) Jumping
2) Slope angle limiter
3) ?

I need these 2 points in my project, I implemented first and working on second, but due to lack of experience in this field, things are not very good. So idea of this topic is to consolidate efforts and improve Bullet's Character Controller.

Does anybody want to help?

Thanks in advance!
ihar3d
Posts: 25
Joined: Wed Jan 23, 2008 11:28 am

Re: Let's make Character Controller better.

Post by ihar3d »

I will try to start discussion.

Jump trajectory formula which I use is not difficult:

Code: Select all

void ProcessJump(btCollisionWorld* cw, btScalar dt)
{
m_jumpTime += dt;
btVector3 newPos;
newPos = m_startJumpPosition +
(m_velocityOnJumpStart + m_jumpStartVelocity)*m_jumpTime +
(btVector3(0, m_fallAcceleration, 0)*m_jumpTime*m_jumpTime)/2f;
m_targetPosition = newPos;
...
//the some code as in btKinematicCharacterController::stepForwardAndStrafe
}
There are 2 problems:
1) where is the best place to call ProcessJump?
2) what logic should be used to recover character from penetration during jump?
ihar3d
Posts: 25
Joined: Wed Jan 23, 2008 11:28 am

Re: Let's make Character Controller better.

Post by ihar3d »

Hello!

I have implemented slope limiter for Kinematic Character Controller, please find patch in attachment.
It works fine, maximum slope angle is set to 45 degrees in demo, and there are 3 boxes which are rotated on 30, 45, 60 degrees, there is 4th which is placed behind 2nd and is rotated on 55 degrees. Character can move on first and second and can not on 3d and 4th, but it can slide down from all.

But I have problem with this code, because climbing (on stairs as example) does not work. Does anybody have idea how to fix this?

As I understand, CC performs step up - collision detection + recovering from penetration -> step forward + CD+RFP -> step down. So step up is performed even it is not necessary (movement just in forward direction on plate), and CC is placed on correct place in step down in this case. In which way I can detect if climbing was happened?

Thanks in advance.
You do not have the required permissions to view the files attached to this post.
ihar3d
Posts: 25
Joined: Wed Jan 23, 2008 11:28 am

Re: Let's make Character Controller better.

Post by ihar3d »

I found solution, now slope limiter works fine for me. Code can be optimized of course, it is first working version. Please find patch in attachment. So this was first step to make CC better. Any help is welcome!
You do not have the required permissions to view the files attached to this post.
ZoranVitez
Posts: 1
Joined: Wed Nov 25, 2009 12:16 pm

Re: Let's make Character Controller better.

Post by ZoranVitez »

Thanks for the effort! I might be able to contribute later on