Categories
Uncategorized

Integrated Newton Game Dynamics

I spent the last two days integrating the basics of Newton Game Dynamics physics with my game. It took about 2 days – in some ways easier than I thought, but due to lack of forum responses and incorrect documentation I also wasted a lot of time. Note to others: setting an angular velocity on an object that isn’t moving is ignored unless you unfreeze it, even though it doesn’t say this in the manual yet does for other similar function calls.

I got Newton integrated enough to have the fighter fly around and shoot bullets. My FPS went from 30 to 2 with as few as 10 bullets on the screen. I actually set all those objects to use non-collidable ‘materials’ with respect to each other, (or I think I did, it’s hard to tell with the poor documentation and closed source) so I don’t know what the problem is.

I’m going to debug and profile where the slowdown is coming from. I really hope the fault isn’t with Newton, because I’ve finally learned how to use it and don’t want to waste another 2 days learning something else.

As an aside, I’ve found that in general I have a far easier time with open source libraries than closed ones. For example, I just spent 2 hours trying to track down why my objects weren’t moving, while they were immediately before I checked in. It turned out a bad merge set my world size to have the same value for z on both the min and max axis – so all objects were outside the physics world. Rather than asserting, or returning false, Newton just silently doesn’t work. If I had the code, I could have figured out why in about 10 minutes, as opposed to nearly giving up and changing to PhysX.

Leave a Reply

Your email address will not be published. Required fields are marked *