I have followed this script but it still won’t rotate
using UnityEngine;
using System.Collections;
public class RandomRotator : MonoBehaviour
{
public float tumble;
void Start ()
{
rigidbody.angularVelocity = Random.insideUnitSphere * tumble;
}
}
I’ve also changed it to “GetComponent” code because I’m using the new 5.0 script. but still doesn’t work.
I had the same problem, double checked everything, followed every suggestion in this thread and then I started fooling around with the Random.insideUnitSphere and replaced it by creating a vector3 with all of its values being “Random.value”.
Nothing worked… except for capitalizing my Start function…
void Start()
NOT
void start()
I feel dumb and defeated sometimes but then I realize I learned another simple lesson today that I won’t be needing again tomorrow…
I’m sorry if this is not the answer to OPs problem, but perhaps it will help someone with my problem.
Simple fix trick. Check Kinematic on the asteroid rigid body. Save scene then project. close unity. reopen unity and uncheck Kinematic. Make sure the code looks like this.
using UnityEngine;
using System.Collections;
public class RandomRotator : MonoBehaviour
{
public float tumble;
Also make sure to go ahead and tag the asteroid as “hazard.”
private Rigidbody rb;