Move by parent coordinates

Hello,

I have a billiard game and the que object is like follwing:

  • queObject
  • queObjectGraphic

So as you can see the graphic is inside the parent holder object. Like on the image:

When I move the CHILD graphic by X…it moves slightly right…to create the illusion that the
player is preparing for the shot.

In the EDITOR it works right…but I cant get this to work by code:

queGraphic.transform.position = new Vector3 (strenght, queGraphic.transform.position.y, queGraphic.transform.position.z);

This is placed inside the QueScript.cs that is attached TO THE QueHolder parent object,
so Im assuming its relative position.

What am I doing wrong?

Mirza

you might want to look at using the localposition, i.e. child position relative to parent

transform.position is world position