I’m beginner in unity scripting and i want to know that is there any way to change positions alone depending on the local axis of another object.
I have a game object and i want to move it depending on the local axis of the camera. the camera rotates with gyro.
This is an example:
float step = 20f * Time.deltaTime; // change -20f to move it the opposite way, also controls how big/small the step in that direction is for each call.
Camera camera = Camera.main;
transform.position += camera.transform.right * step; // moves right or left
transform.position += camera.transform.up * step; // moves up or down
transform.position += camera.transform.forward * step; // moves towards or away from camera
H, i found answer you can use Transform.Translate(object to rotate,object whose axis to refer)