Collision, bounce and spin routine:
Here is the continuation of my collision & bounce routine. Now it has spin along with bounces, and even the start of adding gravity. I've got it to this point before I really have to start getting into rolling and laying on a surface, which will get very difficult I'm sure. But since it's at this point I thought it must be a good framework to start with anyone's looking for this sort of thing. It does alot, and you get the benefit of having a few weeks' work already done for you. But like I said, for it to go any further which I'm planning to do, is much more to be done, but I thought it was a good enough start that someone could get something out of it.
This uses Sparky's DLL an EZRotate. If you don't have EZRotate, you can take out the EZro command, but the object won't spin correctly after a couple/few bounces. That's why I needed EZRotate. However, it still creates the spin results properly even if DB doesn't rotate correctly, and someone may be able to use that. I was trying to learn rotation matrices to try to overcome the problem...has anyone seen the equations for rotation matrices, and the understanding that goes into them? Yeah right. Though I'll say that my main problem was actually getting the formulae put into working equations...THAT is the really complicated part. Learning vector operations was tough enough, but that other stuff...whew. If there was working code for rotation matrices then that would make everyone's life a lot easier in this area, but that's when I found out that DB actually did handle the axes differently and that it was a known problem to rotate objects 'independently', and that EZRotate actually addressed these issues. But I thought since we had "Fix Object Pivot", doesn't that make the need for EZRotate obsolete, since we can reset the object's axis after turning it (the mesh), and be able to re-start the rotations from 0? I don't know, but apparently someone knew there was a need for what EZRotate does...I know it fixed this problem. I tried for 2 weeks to fix my code thinking it was wrong, since I'd see it work correctly for the first few bounces. Deceptive.
So, before I start to try to finish whatever this is going to be, I'll put this part up and see if anyone can use it. Suggestions for what you can do (in the code):
You can mess with the gravity or take it out completely. It's a bounce routine with no gravity to start with...
Try to get friction from previous spin to alter the direction of the object, and cause the object to lose energy on each bounce.
Any number of things that can be added...that's why its pretty open ended at this point and I wanted to put it up...have fun.
http://www.geocities.com/crmnlelmnt/