Tag Info

New answers tagged


Use Transform.TransformDirection() method where Transform is your player transform. // Calculate the x-axis relative to the camera camera = Camera.main.transform; cameraRelativeRight = camera.TransformDirection (Vector3.right); // Apply a force relative to the camera's x-axis rigidbody.AddForce (cameraRelativeRight * 10);


For some reason the tween library requires you to update the tween inside your onComplete function, and calculate the time using something like the following: .onComplete(function () { tweenStart.x = pos[i][0]; tweenStart.y = pos[i][1]; i += 1; if (i >= pos.length) i = 0; tweenEnd.x = pos[i][0]; tweenEnd.y ...


The simplest and non mathematical (noob) way to do this is to make Game object B a child of Game object A , then make local position x as zero and remove B from the parent A. B.transform.parent = A.transform; B.transform.localPosition = new Vector3 (0, B.transform.localPosition.y, B.transform.localPosition.z); B.transform.parent = null;

Top 50 recent answers are included