howdy,
I think that the crazy-radiation levels that impregnated this thread have decayed to background norms, so…
Before i start, i should say that the version i left on the web is now somewhat out of date, having languished due to the lack of apparent interest ( mumblemumblebastardsmumble ). The latest version has some useful improvements:
- automatic rigidification is now vastly more intelligent, uses less constraints and generates more stable bodies
- an architectural tweak that allows clouds of unconstrained particles, ideal for use as bullets
- you can now query constraints in order to assess how much strain they are under, useful for calculating damage to objects
These were all prompted when i stopped living in clean-design-world, and attempted to actually use the bloody thing. I’ll upload the newest version and the “game” i made later on tonight.
[quote] How would I go about actually adding it to my own work?
[/quote]
The two approaches that i can think of are…
- subclassing the Kinetix entities so that your game objects are Bodies and your bullets are Particles etc.
This is good because their physical behaviour will just happen naturally, and any additional behaviour can be added in the subclassing.
This is bad because you game objects will have to live and move entirely in the Kinetix environment, so you would have to be careful about how you make your game entities move about. Simply setting their positions would introduce arbitrarily large forces into the simulation.
For example, in the game i made, instead of simply setting the ship’s angle every frame, i had to simulate the action of the ship’s engines by giving the ship a rotational acceleration. This made controlling the ship extremely difficult, so i then had to add the steering arrow and let the game decide which way to accelerate.
- Run the simulation seperately from your game, and have some kind of linkage layer between the two that reflects events in one side onto the other. For example, if the game component decides that a rock has been hit by a bullet, the linking layer would then apply an appropriate force to the body representing the rock in the Kinetix simualtion. Conversely, the Kinetix component would then update the game component with the position of the rock in every frame.
This is good because it allows for applying the simulation to a subset of game objects. You could also swap out the Kinetix component for another physics engine (as if you’d want to! ;)) without too much hassle.
This is bad because of the added overhead of the linking layer, and it’s not a particularly tidy solution. You also have to be careful about synchronizing the states of the two components, making sure each entity is properly matched with it’s peer, etc.
Perhaps that’s enough to be going on with for now, what kind of game were you thinking about doing?