- Home /
Mario Coin like rotation
This is not really a question. but for those who might find it usefull:
var rotateSpeed : float = 15.0; //Your speed
function Update () //The update function will trigger your object to make it rotate { transform.Rotate (0.0, 0.0, rotateSpeed * Time.deltaTime); //It never stops rotating. }
I believe that the coins rotate around the y-axis which passes through center of an object vertically.
And voted to close so that the community bot doesn't bring it back up. Nothing against you :)
If you want to make code contributions, feel free to add code to http://www.unifycommunity.com/wiki/
Answer by himanshu619 · Dec 07, 2012 at 05:54 PM
Here is the code for you: using UnityEngine; using System.Collections;
public class rotate : MonoBehaviour {
public void Rotate() {
//transform.rotation = Quaternion.AngleAxis(30, Vector3.up);
//var rot = transform.rotation;
//transform.rotation = rot * Quaternion.Euler(0, 90, 0); // this is 90 degrees around y axis
if (transform.up != Vector3.up) {
transform.LookAt(transform.position + transform.forward, Vector3.up);
//transform.Rotate(Vector3.up * Time.deltaTime *20, Space.World);
}
}
}
Make this answer as correct if i works for you! Thanks.
Your answer
Follow this Question
Related Questions
Rotating doesn't work correctly? 2 Answers
A node in a childnode? 1 Answer
Rotate rigidbody towards mouse position 0 Answers
Rotating sprite through touch (storing current rotation) 0 Answers
Sphere rotation in moving direction 1 Answer