Question by
DAEMONREDAXE · Feb 27, 2018 at 09:56 AM ·
rotationtransform
im trying to make my mini gun rotate up and down more than >0degree and less than <30degree, can anyone help me please?thanks!
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class upanddown : MonoBehaviour { public float velocidadeRot;
void Start () {
velocidadeRot = 30.0f;
}
// Update is called once per frame
void Update () {
if(Input.GetButton("W")){
transform.Rotate(0,0,-velocidadeRot*Time.deltaTime);
}
if(Input.GetButton("S")){
transform.Rotate(0,0,velocidadeRot*Time.deltaTime) ;
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Unity 2D lookat and shoot issues 0 Answers
GameObject not looking at me.. 1 Answer
how do I rotate an object without affecting later rotation? 0 Answers
Creating a camera controller for isometric view - Positioning the camera 1 Answer
How to make the rotation of a child object of object A match the rotation of object B ? 0 Answers