[System.Serializable]
public class Boundry{
public float minX,maxX;
}
public class movements : MonoBehaviour {
public float z_speed = 10.0f;
public float x_Speed;
public float tilt;
public Boundry boundrys;
Rigidbody body;
void Update (){
}
void FixedUpdate (){
body = GetComponent<Rigidbody> ();
float movehorizontal = Input.GetAxis ("Horizontal");
Vector3 movement = new Vector3 (movehorizontal, 0,0);
body.velocity = movement * x_Speed;
body.position = newVector3(Mathf.Clamp(body.position.x,boundrys.minX,boundrys.maxX),0,0);
body.rotation = Quaternion.Euler(0,0,body.velocity.x * -tilt);
}
am using this script from spaceship tutorial but am having a problem with moving forward on z-axis continuously. I want my player to go in a forward direction on the z-axis continuously and also rotate on z-axis for tilt effect but unfortunately, I can’t move forward am just stuck in one place and am just a beginner in scripting so pls help me out with this problem