this is my script that should make my weapon fire but in the console bar at the bottom
an error comes up saying unexpected token: }.
im hopeless with scripting so could someone please write me another one or correct me?
heres my script.
var projectile : Rigidbody;
var speed = 20;
function Update()
}
if( Input.GetButtonDown( "Fire1" ) )
}
var instantiatedProjectile : Rigidbody = Instantiate(
projectile, transform.position, transform.rotation );
instantiatedProjectile.velocity =
transform.TransformDirection( Vector3( 0, 0, speed ) );
Physics.IgnoreCollision( instantiatedProjectile. collider,
transform.root.collider );
{
It helps if you place the code in the 'code' format (the 101010 icon in the post) - it puts people off the post when its not in the correct format. Anywhoo, this should work:
var projectile : Rigidbody;
var speed = 20;
function Update() {
if( Input.GetButtonDown( "Fire1" ) ){
var instantiatedProjectile : Rigidbody = Instantiate( projectile, transform.position, transform.rotation );
instantiatedProjectile.velocity = transform.TransformDirection( Vector3( 0, 0, speed ) );
Physics.IgnoreCollision( instantiatedProjectile. collider, transform.root.collider );
}
}
Your code look right, but i noticed that your brackets are facing the wrong way like so:
function Update
{
//Type stuff here :) <--- that is how it should look.
}
function Update
}
//This is the wrong way. <--- your brackets are turning the wrong way. That seems to be the problem. :)
{
Hoped that helped :)
system
4
tnx Oliver the script works fine except for 1 thing the bullets spawn, But
they dont go on the right angle when you play en you see the guns (the P90`s)
shoot but the bullet go`s left instead of going straight away.
can you help me out tnx
greats wesley