- Home /
Adding a secondary transform to a gameObject's transform
So, I'm pretty new to Unity but I have gotten the hang of attaching scripts to objects and making them behave in various ways. What I want to know is if there is a way to have a single transform (for instance the regular gameObject.transform) have a "secondary" transform attached to it?
For example, I want to be able to make an object float and rotate in the air, but I don't want its actual position to change unless I tell it to. So, if an object is created at location (10,10,10), but the secondary transform is (1,2,3), it's rendered at (11,12,13).
I tried gameObject.transform.localPosition and .localRotation but that ended up resetting its global position.
Let me get this straight, in the example you gave, you want to have an object positioned in mid-air not moving, and, yet, rotating?
No, I want it to be able to keep track of its "actual" position while rendering it at the combined sum of its actual position and a sub-transformation/rotation.
Answer by Loius · Nov 05, 2010 at 02:43 AM
Add a child object, and consider that to be the "secondary" transform - adjust its local values sa needed.
Your answer
Follow this Question
Related Questions
Control Ship and Gun Separately 2 Answers
Transform - GameObject? 1 Answer
Camera rotation the same as player rotation 1 Answer
C# 2d Always Rotate Facing Gameobject 1 Answer
Relative Rotation of GameObject 3 Answers