Hi,
I’m somewhat new to unity 3d. What is the code in javascript to make transform.position Script function move an object a certain distance, but not setting the exact location?
Let me know if you don’t get it
Thank You
Hi,
I’m somewhat new to unity 3d. What is the code in javascript to make transform.position Script function move an object a certain distance, but not setting the exact location?
Let me know if you don’t get it
Thank You
If you want to define a world position relative to the player, use transform.TransformPoint:
// pos is 1 unit in front of the object:
var pos: Vector3 = transform.TransformPoint(0, 0, 1);
If you want a world direction relative to the player, use transform.TransformDirection:
// dir is a vector pointing the object's forward direction:
var dir: Vector3 = transform.TransformDirection(Vector3.forward);