lop sided rolling?

Blitz3D Forums/Blitz3D Programming/lop sided rolling?

daaan(Posted 2004) [#1]
hi i wanted to know how to do lop sided ball rolling. like if i was rolling an egg how would i make it roll like an egg and not a ball.

thanks,


Jeremy Alessi(Posted 2004) [#2]
To do it properly? Calculus! Other than that ... use your imagination to the best of your ability to fake it.


big10p(Posted 2004) [#3]
To do it properly? Calculus!


Hey! Swearing's not allowed on these forums. :P


Tom(Posted 2004) [#4]
Tokamak or ODE physics libraries


poopla(Posted 2004) [#5]
To do it properly? Calculus! Other than that ... use your imagination to the best of your ability to fake it.


Don't forget our friends Geometry and Trigonometry!! :)


sswift(Posted 2004) [#6]
You're asking a pretty complex thing. As others said, your best bet would be a physics library.

Faking it works okay with perfectly round spheres, but it'd probably be pretty hard to get a fake that works with an egg, and you can probably forget about more complicated shapes.

In order to model this yourself, I think you need to move the object forward, and use the points where it contacts the ground to apply rotational motion to it. In other words, if you have a simple ball, and you push it forward, the point where it contacts the ground moves backward relative to the center of mass. This pulls that point backward, which in turn causes the ball to roll forward, and another point to come into contact with the ground instead.

Imagine you place a pivot at each point where the object comes into contact with the ground. These pivots are pixed to the surface of the object, but also fixed in positon where they touched the ground. As you push the center of mass of the object forward, you pivot the object around the pivots that are in contact with the ground. This in turn causes some of the pivots to lose contact with the ground.

In some cases you might have three or four pivots touching the ground. The other pivots must limit the way the object moves, but they must also be allowed to lose contact with the ground if need be. I'm not sure how you decide which pivots are important and which are not.

Anyway you can see it's pretty complex. And what I talked about doesn't even take into account the possiblity of the pivots sliding across the ground with ground friction. If you push a table at a certain height it'll just slide along the ground. If you push it higher up though and apply enough force, it might tip over.


Tom(Posted 2004) [#7]
Is the egg boiled or raw? That would affect how it rolls too! :)

just kiddin!
Tom


D4NM4N(Posted 2004) [#8]
you could use case statements between (ie) -90 and 90 degrees to increase the y axis by a set amount variing on the angle of contact. This would be the simplest (and lamest) way but itd work fine. But might take lots of trial and error. The best way to do it is to wiite a small program which prints the y pos of the egg, and a line accross the bottom. then rotate it by whatever amount ie 4deg and then use the (ie) up arrow to aline it to the line. Read your y co-ordinate and write it down for that frame. Time consuming yes but if you have less frames its not too bad, probably better to put all the cases in a seperate include file as there will need to be at least 30 of them to get a smooth anim :)
not perfect but it may do!