- Home /
The question is answered, right answer was accepted
Auto shooting script.
Hello. I have a touchgame that i am working on, and its a platformer game. I have 2 cubes that are going to shoot at eachother automaticly, without the use of aiming etc.
Does anyone have some kind of script to make this work? Thanks
You aren't going to get very far here by requesting scripts.
You're better off researching on how to do something yourself then come back with more specific questions such as I tried this with this script I came up with, but x doesn't work, what am I doing wrong. Good luck
Answer by mlmihjaz · Jun 22, 2014 at 06:29 AM
var projectile : Rigidbody;//HERE DRAG A BULLED WITH RIGIDBODY IN INSPECTER
var speed = 20;
var rate : float = 0.5;
private var rate_time : float;
function Update()
{
rate_time = Time.time + rate;
var instantiatedProjectile : Rigidbody = Instantiate(projectile, transform.position, transform.rotation );
instantiatedProjectile.velocity = transform.TransformDirection( Vector3( 0, 0, speed ) );
Physics.IgnoreCollision( instantiatedProjectile. collider, transform.root.collider );
}
Follow this Question
Related Questions
Make enemy more intelligent 0 Answers
My gun won't fire. ( Javascript ) 1 Answer
How to shoot a puck straight? (JS) 0 Answers
how to combine my move script and my shoot script into 1 script 3 Answers