BGE Animation in wrong place I am having some trouble with animations in the BGE.


I have a sphere in an inactive layer.  
I animate this sphere  
Another object in motion in the active layer hit a certain sensor and create the sphere in the hit position.
A always sensor in the sphere play the animation


Now the problem: The animation plays in the wrong place, no matter where  the hit point, the animation plays in the same spot. The sphere is created in the right spot, but disappear and the animation play in the wrong place, why?
Positional keyframes are always relative to the parent. When you add an object via AddObject it has no parent. Therefore it plays relative to the scene's origin -> it jumps away.

Solution


Add an empty to the hidden layer.
Parent your object to the empty.
AddObject the empty rather than your object.


Effect 

This will add the empty with all of it's children, including your object. Your object will play the animation relative to it's parent, which is the  empty. The empty gets the position from the adding object.

I hope it helps