i m using three rocks for my game all three moves in the direction of x-axis, i’ done with moving the rock on the x axis but i also want to rotate them on Y axis, so the rocks move on x axis with some spin, sorry my English is too bad hope you can understand, Thank you in Advance…
here’s my script for moving the objects.
public class object1 : MonoBehaviour {
[SerializeField] private float objectSpeed = 1;
[SerializeField] private float resetPosition = -35.5f;
[SerializeField] private float startPosition = 66.9f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
protected virtual void Update () {
if (!GameManager.instance.GameOver) {
transform.Translate (Vector3.left * (objectSpeed * Time.deltaTime));
if (transform.localPosition.x <= resetPosition) {
Vector3 newpos = new Vector3 (startPosition, transform.position.y, transform.position.z);
transform.position = newpos;
}
}
}
}