I have this script to spawn a powered up ball from a brick when hit. What I want it to do is spawn and travel in a random direction. BUT only in the X and Y axis (eg upwards, up-right, right, down-right, down, down-left…etc…) I don’t know the wording to add in: instancesuperbullet.rigidbody.AddForce(transform.down * shootforce);
Would it be …(transform.random, x, y); something like that?
thanks
var prefabsuperbullet:Transform;
var shootforce:float;
function OnCollisionEnter ( collision : Collision) {
if (collision.collider.name == "Bullet"){
var instancesuperbullet = Instantiate(prefabsuperbullet, transform.position, Quaternion. identity);
instancesuperbullet.rigidbody.AddForce(transform.down * shootforce);
}
}