My script loops the game object up and down, but I would also like a constant force for it to move left. How can I implement it?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ysaucermove : MonoBehaviour {
public float amp = 0.75f;
public float freq = 1f;
// Position Storage Variables
Vector3 posOffset = new Vector3 ();
Vector3 tempPos = new Vector3 ();
// Use this for initialization
void Start () {
posOffset = transform.position;
}
// Update is called once per frame
void Update () {
tempPos = posOffset;
tempPos.y += Mathf.Sin (Time.fixedTime * Mathf.PI * freq) * amp;
transform.position = tempPos;
}
}
Help, please!