i have simple unity project where i created simple cube. When i press spacebar this cube jumps.
My Problem is - i want to implement also 360 Rotation around Y-axis (only once and then stops) when i press spacebar. How can i do this?
Heres my current code:
void Start () {
mSpeed = 3f;
RB = GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update () {
transform.Translate(mSpeed*Input.GetAxis("Horizontal")*Time.deltaTime,0f,mSpeed*Input.GetAxis("Vertical")*Time.deltaTime);
//transform.Rotate(Vector3.up, 100 * Time.deltaTime);
if (Input.GetButtonDown ("Jump"))
{
RB.velocity = new Vector3 (0,5,0);
}
}