Bouncing ball physics
by Jason McIntosh · in Torque Game Builder · 03/02/2005 (12:38 pm) · 4 replies
Just curious, but is there a way to have the physics system do the vector reflection for a bounce collision response so I don't have to create all this sub-system stuff to get the unrealistic response I need? :)
It bounces objects off the WorldLimits, so can we also use that to override other collision responses? Would it handle the arbitrary angles of collision polys?
Or am I doomed to finish the physics system I started so I can achieve this?
TELL ME MY FATE!
(Sorry. Got a little too dramatic.)
It bounces objects off the WorldLimits, so can we also use that to override other collision responses? Would it handle the arbitrary angles of collision polys?
Or am I doomed to finish the physics system I started so I can achieve this?
TELL ME MY FATE!
(Sorry. Got a little too dramatic.)
About the author
#2
%obj.setRestitution( 1 ); // 1 = perfect bounce, 0 = no bounce
be sure to make sure you've set it up for collisions and to "bounce" off of the world limits.
03/02/2005 (2:30 pm)
Yes you can:%obj.setRestitution( 1 ); // 1 = perfect bounce, 0 = no bounce
be sure to make sure you've set it up for collisions and to "bounce" off of the world limits.
#3
T2D is fantabulous!
03/02/2005 (3:44 pm)
Holy cows!! I changed the restitution to 1 and it made a huge difference. Thank you, Melv! Now I'll fiddle with the other stuff.......T2D is fantabulous!
#4
04/05/2006 (8:25 am)
I dont get any angular velocity on the ball... It bounces around correctly without angular velocity. The min and max are 0 and 10000 respectively.
Associate Melv May
Understanding how the physics works is key to configuring it into a "dumb" mode.
Try the following:-
- Ensure that you've got no friction so set that to 0.
- You want almost perfect bounces to set the restitution to 1.
- You don't want energy to bleed-off so set the damping to 0.
- Keep the forces within reasonable bounds by adjusting the density of your object. Density is very sensitive so tweak with small fractional increases although the default is good.
- You want all the energy to be dissipated into the bouncing object so set the other object to be immovable (density 0) - helper func setImmovable().
- You don't want your objects to rotate so set you max-angular velocity to 0 although you get more accurate results from an object that spins.
Follow these rules, most of which can be defined in a collision-material datablock and you will be okay.
If you continue to struggle, I'll post a simple example soon.
- Melv.