Hello! Sorry for my english im from ukraine, is the object that you want to turn on its axis, but the axis is slightly angled. I object turns like this: 1.
But we need to properly scrolled =) like so: 2.Here is my script for the scroll object:
public class RevolverScript : MonoBehaviour {
private float rotate_y ;
public float spin_speed = 100;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetKey ("left")) {
print("left");
rotate_y +=(spin_speed * Time.deltaTime);
}
if (Input.GetKey ("right")) {
print ("right");
rotate_y -=(spin_speed * Time.deltaTime);
}
rotate_y = rotate_y%360.0f;
this.transform.rotation = Quaternion.Euler(0, rotate_y, 0);
}
I tried to edit the pivot and still trying to shove my object in perfab. But this is not all useful, I do not know what to do. It seems to me that it does not really do. Please help as many races have tried to make himself but without success.3 for downloat this project.rar
thenks for answer, but its not work. I think can also try to use RotateAround, but also that it does not work: this.transform.RotateAround(cube.transform.position, Vector3.up, 90 * Time.deltaTime); Maybe I'm doing something wrong with the coordinates?
– timedoit helped me: this.transform.Rotate(Vector3.up, Time.deltaTime * 90);
– timedo