- Home /
Help with hold x,y,z rotation
This question might be Abit noobish but, is there i can store rotation angles like using vector3 for position. An example of what I want is like this
Vector3(x,y,z)
but for rotation
do't use quaternions unless you REALLY know what you're doing .. untiyGE$$anonymous$$S.com
14 is a good age to learn program$$anonymous$$g, maybe a little late, good luck !!
Answer by Fattie · Jan 02, 2013 at 04:36 PM
Ceejay! you should know how to use the documentation now!
just go here
http://docs.unity3d.com/Documentation/ScriptReference/Transform.html
and find what you need.
In fact it is "eulerAngles"
For example, you could say
Debug.Log("the angle on the y axis is " + transform.eulerAngles.x );
Anything you need regarding Transform, go there and find it!
Later you can learn about Quaternions - but you'll need to read unityGEMS.com
Cheers!
Hey Ceejay, re your further question ...
Instantiate(create,
Vector3(
hit.collider.gameObject.Find("0").transform.position.x,
hit.collider.gameObject.Find("0").transform.position.y,
hit.collider.gameObject.Find("0").transform.position.z),
hit.collider.gameObject.Find("0").transform.rotation);
Basically try something like this ...
var oldEulerAngles:Vector3;
oldEulerAngles = gameObject.Find("0").transform.eulerAngles;
now you can modify that, you understand? try this for example:
oldEulerAngles.x = oldEulerAngles.x + 25;
so after you have done that, try something like this:
var newObject:GameObject;
newObject = Instantiate( create );
newObject.transform.position = gameObject.Find("0").transform.position;
newObject.transform.eulerAngles = oldEulerAngles;
you understand that ??
Let us know if you need more help.
Read this one for many examples of how to Instantiate ... cheers!
http://answers.unity3d.com/questions/321762/how-to-assign-variable-to-a-prefabs-child.html