Hello,
I’m making my first game whit unity 3d now i need to make that my thank shot something,but how can i make a shot?
I don’t understand what you’re saying
Save this as SpawnWithForce.boo
import UnityEngine
class SpawnWithForce (MonoBehaviour):
public spawnObject as Transform
public force =999
public frequency=0.5
public timepassed=0.0
public debugAmmountOfBalls=0
def Update ():
if timepassed>frequency:
superball as Transform=Instantiate(spawnObject,transform.position,transform.rotation)
debugAmmountOfBalls++
superball.rigidbody.AddRelativeForce(0,0,force)
timepassed-=frequency
timepassed+=Time.deltaTime
Note the identation is VERY important
@DragonReeper
Oh,thank you guy so is just to create an object and after use a force to move the ball isn’t it?
@kil.ler_un.ity
Sorry for my bad English I’m Brazilian:(
That’s what a bullet is , but I’d recommend you use raytrace to check collisions as that works better for actual bullets,
not sure if you want that though since if its a tank it should have gravity affecting it and also the tank missile is large so you could get away with it , just be sure to use a box collider for the missile
So bullets and ray casting…Is that something like this:http://www.docstoc.com/docs/26688682/Unity3D---Helicopter-Tutorial yeah?
if you use raycasting and you want the bullet to be affected by gravity you could create an object that cast a ray forward if it doesn’t touch anything it can translate forward form its position and rotate accoridinglly downwards,
That example should work but you should experiment to see what looks right