The question is answered, right answer was accepted
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;
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 );
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a user guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
Answers and Comments
1 Person is following this question.
Make enemy more intelligent
why won't my code work?
iTween Help Please MoveTo not working
Top Down Shooter Enemy AI using raycasting
AI help people