lianlab / bullet

Automatically exported from code.google.com/p/bullet
0 stars 0 forks source link

Adding functionality to btKinematicCharacterController #196

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This is a feature enhancement, not a bugfix.

At the moment, the character controller has only one way to move the
character: setWalkDirection().  The caller provides a vector which
specifies how far the character should move in each simulation step,
regardless of dt.

In a larger codebase, that isn't as useful.  The code asking the character
to move may not know or control the simulation time step dt.

Also, in networked games, it is quite common for the client to tell the
server "player X moved this direction over time interval T."

I've added a new method, setVelocityForTimeInterval().  The caller provides
a velocity, and time period T over which the velocity applies.  Then the
character will move with that velocity for that time period, however many
simulation steps it takes.

Changes:

 - added a normalizedDirection member variable.  This is
     slightly more efficient than recalculating the normalized
     direction every simulation step.

 - I overloaded the m_walkDirection member variable to hold
     either the walkDirection or the Velocity, and used a boolean
     flag to determine which behavior was required.

 - The normalization behavior seemed custom, and I needed it
     twice, so I moved it to a static helper method.

 - I added the setVelocityForTimeInterval() method to the
     base interface class.  This to me is the scariest change
     since people inheriting from it will need to make changes
     (if only to add an empty function).

 - I added Doxygen comments for this.

Patch is included.  As usual, all comments/feedback welcome.

    -Thomas

Original issue reported on code.google.com by astroboa...@gmail.com on 20 Feb 2009 at 4:40

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for the patch. We'll apply it right after this 2.74 release (no time to 
do 
more testing right now).

Original comment by erwin.coumans on 3 Mar 2009 at 11:18

GoogleCodeExporter commented 9 years ago
I just tried to applied the patch, but there is a conflict because Bullet now 
uses 
the btActionInterface.

Would you mind re-applying the patch on the latest trunk?

Otherwise, we'll still can manually apply the patch, but it might get delayed a 
little bit.

Thanks,
Erwin

Original comment by erwin.coumans on 14 May 2009 at 5:13

GoogleCodeExporter commented 9 years ago

Original comment by erwin.coumans on 14 May 2009 at 5:48

GoogleCodeExporter commented 9 years ago
Hello-

I just sync'd and rebuilt.  I didn't have any merge conflicts.  I tested in my 
app
and the rebuilt libraries appeared to work.

Updated patch is attached.

     -Thomas

Original comment by astroboa...@gmail.com on 17 May 2009 at 6:57

Attachments:

GoogleCodeExporter commented 9 years ago
Your patch has finally been applied,
http://code.google.com/p/bullet/source/detail?r=1675

Thanks for the patience :)

Original comment by erwin.coumans on 23 May 2009 at 2:29