Question by
unique11 · Feb 08, 2018 at 05:12 PM ·
c#unity 5scripting problem
Changing an objects location
Hi, I'm trying to change an object's location in c# script, but only documents i find are about changing it with force like the code below. and the problem here is i don't want it to be continuous i want to change it to exact values like " x:-1.239, y:0, z:2.355 " and rotate it to " x:0, y:-75, z:0 " how can i do that? any suggestions?
Vector3 temp = transform.position;
temp.x = 10.0f;
transform.position = temp;
thanks
Comment
Best Answer
Answer by yummy81 · Feb 08, 2018 at 05:33 PM
Try this:
transform.position = new Vector3(-1.239f, 0, 2.355f);
transform.rotation = Quaternion.Euler(0, -75f, 0);