I'm working on a space game (kind of like asteroids) but I'd like to
be able to adjust the mass of the ship. I can't, for the life of me,
figure out how.
My code sets the properties for a ship with:
def Ship(self, mass, pos, ship):
M = ode.Mass()
But how do I go back later, and adjust the mass? I've tried (using Pygame):
elif e.key == K_d:
#self.Ship(mass, position, ode.Body)
M = ode.Mass()
Yet this does nothing, (as far as I know) to the existing ship (it's
velocity doesn't change). Am I creating a new Mass for the object
instead of modifying an existing one?
All Your Base Are Belong To Us!!! chown -r us ./base
"After three days without programming, life becomes meaningless.'' --
Tao of Programming Book 2
From: Diez B. Roggisch <deets@we...> - 2008-04-07 14:50:19
> But how do I go back later, and adjust the mass? I've tried (using Pygame):
> elif e.key == K_d:
> #self.Ship(mass, position, ode.Body)
> M = ode.Mass()
> M.setSphere(2500, 0.05)
> print M
> print playerShip.getMass(M)
> Yet this does nothing, (as far as I know) to the existing ship (it's
> velocity doesn't change). Am I creating a new Mass for the object
> instead of modifying an existing one?
Obviously you are. You create a new one instead of manipulating an existing
Regarding the effect that has: I'm not sure and can't experiment right now,
and you don't give much information.
Of course if any forces are applied, they should take the new mass into
consideration. If that's not happening, I can only suggest removing the whole
ship and replacing it with a new one to make sure internals are proper.
But what do you expect to happen just because you alter the mass to the flying
ship? Why should it experience any change in velocitiy?