Mesh is sticking into another

Hi guys,

I have an issue where I create one mesh (sphere) and right after I create a box, I animate only the sphere but the box is in somehow attached to the sphere, I didn’t add a parenting command.

this is the pg:

I’m trying to animate them independently but first I need to achieve they don’t stick together.


At lines 55 and 68, when you assign the node’s position:
pacman.position = myPathR[0];

You’re actually assigning the pacman.position and pix.position reference to point to the myPathR[0] vector.

(When the pacman object is animated across the path, the myPathR[0] and pix.position value will change with the pacman node’s position, yikes!)

To fix this, you should instead use:

When you want to copy values from one vector to another, that you expect to modify independently.


Thank you for the explanation. It is due reference values of the vector object?

I’ll follow your fix and let you know how it goes.

Thanks again!!!

Yes, since Vector3 is not a primitive type, it is passed by reference, rather than by value.


Thank you very much! I believed I knew a lot about objects but it seems I have many things to learn still :slight_smile:

Thank you it worked as a charm!