I’m trying to get a bird to fly in my scene. I can get it to move but when my game is run its not starting on the y position i set in my transform. I want my Y transform to be off the plane and I set it in the inspector but when its run it defaults back to 0. how can i solve this?
here is a copy for the script i’m using to move the object.
using UnityEngine;
using System.Collections;
public class FlyAI : MonoBehaviour {
public float horizontalSpeed;
public float verticalSpeed;
public float amplitude;
public Vector3 tempPosition;
// Use this for initialization
void Start () {
tempPosition = transform.position;
}
// Update is called once per frame
void Update () {
tempPosition.z += horizontalSpeed;
tempPosition.y = Mathf.Sin (Time.realtimeSinceStartup * verticalSpeed) * amplitude;
transform.position = tempPosition;
}
}