Question by
Mallika786 · Dec 08, 2016 at 12:33 PM ·
mathfpingpong
how to rotate a gameobject between two angles front and back direction?
Hello every one,
I am learn of Unity 5.4 and I am using visualstudio 2010 for coding. my coding is in C#.
I am trying to create a game object which is continuously rotating front and back direction in between two different angles.my problem is I am able to rotate the game object between origin to other angle successfully but I want to rotate it in between 60 -150 degrees.
below is the code for rotating between origin to any other angle. using UnityEngine; using System.Collections;
public class turret1 : MonoBehaviour {
public float rotF1;
void Update ()
{
transform.localEulerAngles = new Vector3(0, 0, Mathf.PingPong(Time.time * 50, rotF1));
}
thanks, malika.
Comment
Your answer
Follow this Question
Related Questions
Pausing a Mathf.PingPong at the ends 0 Answers
what exactly does Time.time do in Mathf.PingPong? 3 Answers
how to make mathf.pingpong not from 0 3 Answers
Separate Numbers ? 1 Answer
My enemy cube moves through walls 0 Answers