Hi,
There does not seem to be a constructor for the Transform class, i.e.
var myTransform:Transform= new Transform();
also if I have an existing game object myGameObj
and I do
var myT:Transfrom:Transform = myGameObj.transform;
myT.position.x=100;
Then I move myGameObj to position x=100;
i.e. myT is a pointer to the transform on myGameObj.
Can I make an instance of the Transform class, or do I need to create a GameObject so that I can get access to all the functions that the transform class has it it.
Thanks
You cannot have a Transform that is not part of a GameObject, or vice versa, and there is exactly one transform per GameObject.
OK. So if I want instantiate a GameObject “newObject”, 5 units ahead of another game object “existingObject”.
It looks like I need to instantiate the new object at the current position of “existingObject”. Then move the “newObject” 5 units foward (assuming that Ive got the rotations correct)
I was going to get the transform of “existingObject”, then calculate a position 5 units ahead of that position, then instantiate the “newObject” at the calculated position.
But doing it that way, I’d need to write a lot of code, if I can’t use the built in functions in the Transform class.
So it looks like I’ll need to do the instantiation first then move it. (somewhat counter intuitive)