Getting position prior to collision

Is there any way to get the position of a certain object, a box for example, before it collided with another object, a wall for example, so i could restore the localtranslation of the box to the position before it collided with the wall?

you have to save the last position every time you move your object. If a collision

occurs you "just" have to reset the position to the old one. But this is not as easy

as it seems or should be. Something to mention:

  • if saving the position use a clone (.getLocalTranslation().clone()). Otherwise you would

    have a reference on the current position which would result in that savedPosition==currentPosiition.
  • after moving your object use object.updateGeometricState(true,0) or (0,true) (one of both) in order

    to update the worldbounding of the object and the underlying spatials. this is very important.

    Hmm,…if you keep this two in mind you have a chance to succeed :D. I had always problems to get that

    running properly.

    PS: Or you use jbullet-jme for that…(actually I didn't use it yet but it seems to do a quite good job)

Thank you, thank you, thank you! You solved a problem I had been having for ages!