Hello, guys
I am a new in jME, recently I want to combine different objects in right order. Exactly, I want put one object into the very place of another objects, how do I make sure the fomer objets is added to the exact coordinate of the later one. I wonder If I can put a node in the later objects? So I just need attach fomer objects in the node.
Thanks:grinning:
you mean the Pivot Node?
Assuming the two objects are represented by spatials with the same parent Node:
Vector3f offset1 = object1.getLocalTranslation().clone();
object2.setLocalTranslation(offset1);
If they’re parented by different nodes, you might have to do arithmetic to compensate for the offset/rotation/scaling between the parents.
…and note: the clone is unnecessary in this case.
Clone is unnecessary? So what else can I do?
Remove the clone() maybe?
Thanks, I will try this