So I’m working on a spaceship with thrusters. To make the thrusters actually work in the game engine, I would like to have empties inside the thrusters that are child objects of the parent spaceship. Each empty would then have the needed logic bricks to apply force in the direction that the thruster would apply force if it was real. That way, for example, a thruster on the back corner of the spaceship, if fired on its own, would actually start pushing the ship in an angular motion, given its center of mass – just like in real life.
The problem, I am learning, is that child objects can’t push parent objects – or at least I haven’t figured out how to make it work.
Anyone have any ideas on this? Or a different way to achieve the same effect?
I unfortunately don’t have the time to look into this thoroughly, but I would highly suggest finding a way to fake it more than try to make something so reliant on blender’s physic engine.
Probably a better way to go about it than messing around with compound objects or rigid body joints would be to use python and use applyImpulse, which allows you to specify a location (which would be the location of the thruster). A simple example script might look like
g = bge.logic
c = g.getCurrentController()
o = c.owner
parent = o.parent
#make a default value for the thrust, this can be overridden by adding a property named "thrust" to the thruster object.
if not 'thrust' in o:
o['thrust'] = 0.15
vector = o.worldOrientation.col[2]
impulse = vector * o['thrust']
position = o.position
parent.applyImpulse(position, impulse)
Key points to using the script:
the thrusters will apply their impulse to whatever object they are parented to.
the thrusters don’t need to be physics objects, in fact I recommend setting them to “no collision”. Unless you want things to be able to collide with them, of course.
you can change the default thrust by modifying the number in the script, but to change an individual thruster’s thrust you must add a property named “thrust” to the thruster and set it there.
boy howdy, flying rockets is really difficult! Especially without wind resistance to stabilize things.
and an example file:Thrusters.blend (535 KB). Fire the four bottom thrusters with space bar, the two turning thrusters are controlled with A and D respectively.