Stop character from bouncing

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
vToMy
Posts: 5
Joined: Fri Dec 09, 2011 4:19 pm

Stop character from bouncing

Post by vToMy »

Hi,
I have a capsule character bouncing when colliding with a wall. The problem is that the bouncing sends the player upwards a little, and that causes him to fall.
Since the player is moving forward, I don't see where the "up" force is from...
I tried to search a little on the forum and I suspect the problem lies in the orientation of the capsule.
Since I don't want my capsule to tip, I set its orientation to identity every frame (this is little patch, but I didn't find any other solution :roll:).

I tried setting the local inverse inertia tensor to zero, but the character couldn't move after that for some reason :x
The character is dynamic btw.

The desired solution is having the character not bounce at all when hitting the wall (or, at least, not bounce upwards).
Thanks in advance... :D
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Stop character from bouncing

Post by Norbo »

Setting the orientation every frame does not affect the angular velocity, so when collisions occur, odd transfers of momentum will happen.

Setting the LocalInertiaTensorInverse to the zero matrix is the suggested method of addressing this. It only directly affects angular motion, so if the character can't move afterwards, something else is not working properly.

By the way, there are complete and robust character controllers in the BEPUphysicsDemos. The CharacterController supports all the usual FPS behaviors. The SphereCharacterController is another slightly lighter weight character controller that, by virtue of being a sphere, doesn't step over objects but instead slides over the top of them.
vToMy
Posts: 5
Joined: Fri Dec 09, 2011 4:19 pm

Re: Stop character from bouncing

Post by vToMy »

Okay, I looked into it and it seems my character cannot move only when it's on the floor. When I disabled gravity the character could move.
So, I tried zeroing the linear damping, static and kinetic friction, but it didn't help.
I also tried increasing the velocity, and from a certain value the character did move, but it moved way too far... Any thoughts?

Also, is there any way to allow the capsule to rotate only on the Y-axis? Without rotation on the Y-axis, it seems the character can't slide against walls...

I looked into the character controllers in the demo and they are very nice, however I'm not sure I'll be able to integrate them into my game engine so easily... But I'll take a look.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Stop character from bouncing

Post by Norbo »

So, I tried zeroing the linear damping, static and kinetic friction, but it didn't help.
I also tried increasing the velocity, and from a certain value the character did move, but it moved way too far... Any thoughts?

Also, is there any way to allow the capsule to rotate only on the Y-axis? Without rotation on the Y-axis, it seems the character can't slide against walls...
All of those issues seem to be related to friction. Note that the friction of two surfaces is averaged together by default, so setting the character's friction to zero won't fully remove friction. Changing the friction blender to multiplicative or picking the minimum would ensure that the object has no friction.

Another way to manage friction is to use an event to force a pair's blended friction to zero. This is what the characters do with the RemoveFriction function.
is there any way to allow the capsule to rotate only on the Y-axis?
Yes; by setting only the first and third rows of the local inertia tensor inverse to zeroes, the object will still rotate around the Y axis. However, when friction is present, this is not a proper solution. While it might be able to slide better sometimes, the character will act like a flywheel. So if the character spins up, the next time it hits a wall will introduce unintuitive linear motion.
I looked into the character controllers in the demo and they are very nice, however I'm not sure I'll be able to integrate them into my game engine so easily... But I'll take a look.
Making a full featured, robust character controller is one of the more difficult projects in game physics thanks to all the little behaviors required (particularly stepping). Unless there is a fundamental mismatch between the character and the project's requirements, using the already-built one will almost certainly save some time.
Post Reply