- Home /
Question by
ODU · Oct 26, 2014 at 01:42 AM ·
random.range
Add Random force in my scripts
hello enter code here` I try to Add back a random force in my scripts could you help me ??
var obj: GameObject;
var force: float = 999999999999999;
var nums: Transform;
function Start () {
}
function OnMouseDown () {
this.rigidbody.AddExplosionForce(force, obj.transform.position, 5);
Instantiate(nums, transform.position, transform.rotation);
}
Comment
Answer by AlwaysSunny · Oct 26, 2014 at 01:41 AM
When posting questions here, it's best to be more specific. Because this issue is obvious from the code, it's not a big deal, but typically "here's code, please help" is not a question that will be answered.
rigidbody.AddForce(Random.OnUnitSphere*force, ForceMode.Impulse);