Hi
I have a FPS Controller set up my scene and a Plane. I want the plane to move on the same x axis as the player, but not on the z and y axis. How could I do this? Here’s a script I have that that makes the player rotate on the same y axis as the camera when an input is held. Maybe someone could change it a little to make it do what I’m trying to accomplish…
#pragma strict
@SerializeField
var aimSpeed : float;
function Update () {
if (Input.GetButton("Aim"))
Aim();
}
function Aim() {
var aimRotation : Vector3 = transform.rotation.eulerAngles;
aimRotation.y = Camera.main.transform.rotation.eulerAngles.y;
transform.rotation = Quaternion.Lerp(transform.rotation, Quaternion.Euler(aimRotation), Time.deltaTime * aimSpeed);
}
Thanks if you can help!