Freefalling player movement controller

Greetings,

I’m trying to create a skydiving simulator and I’m having problem with controlling it’s movement. I want player to only control the rotation and the velocity shall be calculated depending on the rotation and player’s current falling speed.

using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System;

[Serializable]
public class PrettyPlayer : MonoBehaviour {

[SerializeField]
private GameObject playerObject;
private IInputController controller;
private Rigidbody rigid;

[SerializeField]
private float playerSpeed;
[SerializeField]
private float maxSpeed;
[SerializeField]
private float rotateSpeed;

public Text DebugText;

public float Score;

void Awake ()
{
    #if UNITY_ANDROID && !UNITY_EDITOR
    controller = new MobileController();
    #else
    controller = new KeyboardController();
    #endif
    rigid = GetComponent<Rigidbody>();
}
void FixedUpdate()
{
    Move(playerSpeed);
}
void Move(float speed)
{
    float inputHor = controller.InputHorizontal();
    float inputVert = controller.InputVertical();
   
    transform.Rotate(new Vector3(0, inputHor * Time.deltaTime * rotateSpeed ) );
    transform.Rotate (new Vector3( inputVert * Time.deltaTime * rotateSpeed, 0));
   
}

}

Am I wrong or are you only showing 2 parameters in each of your new vector 3’s for rotation?

transform.Rotate(new Vector3(inputVert * Time.deltaTime * rotateSpeed, inputHor * Time.deltaTime * rotateSpeed, someZRotation ) );

and also you can do this in one Rotate and you shouldn’t forget the Z Value lile tedthebug said

1 Like