so, I have a basic movement script, slightly modified to have my char fly, and I want to have him on an object, but I want him to rotate with that object as well as move. I tried rotating the object, but my char would stop moving or falling the right way. I tried .move as well as .simplemove
using UnityEngine; using
System.Collections;public class Moveing : MonoBehaviour {
public static float flying; public
static float grounded; public float
speed = 6.0F;
public float jumpSpeed = 8.0F; public float gravity = 20.0f; public
Vector3 moveDirection = Vector3.zero;
public float rotateSpeed = 3.0F;
// Use this for initialization void
Start () {} // Update is called once per frame void Update () { transform.Rotate(0, Input.GetAxis("Mouse X") *
rotateSpeed, 0);
CharacterController controller = GetComponent();moveDirection = new Vector3(Input.GetAxis("Horizontal") *
speed, moveDirection.y,
Input.GetAxis(“Vertical”) * speed);
moveDirection = transform.TransformDirection(moveDirection);if (Input.GetButton("Jump")){ moveDirection.y = jumpSpeed;} if ( moveDirection.y > gravity * -1){ moveDirection.y -= gravity * Time.deltaTime; } controller.Move(moveDirection * Time.deltaTime); } }