Bouncing character

Paeronskruven

05-12-2010 10:19:59

Hey everyone!

Im building a 3d sidescroller on my spare time with physics.
I have some problems with my character.

My character is built by a capsule representing the body and then I have a ray shooting down to keep him over the ground.
All physics works great in my simulation except for my ray.
When the ray hits the ground its bounces of alittle and keeps my character bouncing forever.
I can solve this with setting a really high mass on my capsule body but that screws up the rest of the simulation.
Also if I remove the ray the capsule goes to the ground without bouncing just like I want it but I need the ray to get the character to be able to walk up stairs and such.

Anyone know what might cause this?

Done alot of searching the forums but havnt found anything so excuse me if I missed it!
Thanks for any help!
/TL

iwanantonowitsch

05-12-2010 14:16:26

set bounciness lower or do what they do on the ode-mailinglist: let the ray behave like a dampened spring... i've got no idea how to implement a dampened spring but i think you'll figure it out. If you figured it out PLEASE make a tutorial in the wiki ok?

Paeronskruven

05-12-2010 14:49:10

Thanks for the reply!

I already tried changing the bounciness but it doesnt affect my ray at all.
Will check out the dampened spring, thanks for the hint.

Anyone else know what might cause it though?
Because even if it bounces when it falls to the ground it should stop eventually right?

/TL

iwanantonowitsch

05-12-2010 17:06:01

i understood damping as setting a small force backwards to the direction something is moving. so.... get your linear velocity in the vertical direction and add like - 0.01 * [linearvelocity]. that should get the thing done.

EDIT: what i forgot to ask is:
> what is your bounciness constant?
> what is your stepsize? (because my character bounced around like yours until i realized the tutorial's (upon which my code relied) stepsize was like half a second.)
> What is your friction constant? (mine was too high) if its too small things will slide around but you can set their linear veloccit to 0 every frame.

Paeronskruven

05-12-2010 17:54:44

Thanks again for trying to help :)

Damping didnt take care of the problem.

Changing the stepsize, bounciness and friction isnt making any difference at all to the problem.

What really bothers me is that the simulation works perfect and as expected with everything but the ray.

I built a system where I draw diffrent shapes of geometry on the screen and they fall down, bounce if needed and then stay just like it should do.
Im quite new to physics (I work as a webdeveloper :lol:) but I really cant understand why my character keeps bouncing when the ray collide with something.

iwanantonowitsch

05-12-2010 20:07:05

i just used a capsule and it works fine
so just dump the ray it may work for some but hey... no solution in ogre or ode seemed to work for everyone (thats why there is a forum) so you'll have to try

Paeronskruven

06-12-2010 14:15:20

Finally got it to work!

Was playing around with the softness values for the contacts and it does the trick.
Still got some fine tuning to do but at least it works better now.

Thanks for helping me!
/TL