Make object move when hit and then snap back into place

I’m trying to make the block kind of go up when it is hit by the character and then the block snaps back into its original place. I am not exactly sure how to approach this, any ideas? Thanks.

On a collision with the object you do:

[java]Vector3f snapLocation = spatial.getLocalTranslation().clone();[/java]



move it up i guess, or w/e you want then do



[java]spatial.setLocalTranslation(snapLocation);[/java]