I fixed the last of the obvious collision bugs. No more objects flying out of the world, or getting stuck in each other.
Next I tackled rotation. My code was based on some stuff I derived to make rolling boulders a long time ago. Back then,
it was sort of a hack, since the boulders only rolled when rendered, there was no realy concept of them physically rolling.
Also, they were spheres, so that was a bit easier than more general shapes.
Now I'm more or less trying to compute proper angular momentum for the spheres & capsules. What I have now is certainly not
right, but it is closer. For instance, my capsules tend to lie on their sides after bouncing around, which is great for weapons. Lozenges will be better, but capsules aren't as bad as I feared.
Here is a shot of several objects with their collision shapes drawn. The colors are the world space normals. I suppose model
space normals would be more instructive...Ok, just changed it to model space. Much better.
Here is a shot of several weapons lying on their sides, and a boulder just for fun.
Man, those blast decals look good! ;)
I also updated the level editor to disallow entity sizing. This is a good thing, as the entities used to come in in very strange sizes, and it's important that entities have a consistent size in the game. So now it uses data from a csv file to re-scale the objects, and to fit a sphere or capsule to them on the way into the game engine.
One can still size meshes, but not moving entities. If you want an entity with a new size, you have to make a new entity, which involves adding a row to a csv file with the new size, etc.
I'm not finding a ton of good info on angular momentum in game physics. I do have two good code examples to go from, so I'm confident I can work this out at some point.
Now that rotation works, including that introduced via impulses, the spinning dagger won't be too far off. Tomorrow is my day off, so we'll see if it gets done then or on Monday...
I concur, they do look pretty damn sweet.
Jack