- Home /
Question by
thenachotech1113 · Nov 24, 2012 at 02:37 AM ·
addforceshootingdirectiongunprojectile
For some akward reason bullet is moving in the wrong direction
Im trying to make a simple shooting script, but for some weird reason the bullet is moving in the wrong direction, already checked the direction the prefab is actualy aming at and the directoin to wich the spawnpoint is aiming at, here is the script:
#pragma strict
var spawnPoint : Transform;
var bullet : Rigidbody;
var fireDelay = 0.1;
var auto = false;
var magCapability = 26;
var bulletCount = 0;
function Start () {
bulletCount = magCapability;
}
function Update () {
if (Input.GetButton("Fire1"))
{
var Clone : Rigidbody = Instantiate(bullet, spawnPoint.position, spawnPoint.rotation) as Rigidbody;
Clone.AddForce(transform.forward * 10);
bulletCount -= 1;
}
}
(i know the add force variable is to low) i seriulsy cant think why can this be happening. thank all of you
Comment
Answer by greatestprez · Nov 24, 2012 at 02:48 AM
Maybe try Vector3.forward instead of transform.forward?
Your answer
Follow this Question
Related Questions
bullets fly to the wrong direction in specific situations 0 Answers
Help with getting a bullet to move. 2 Answers
Why is my gun shooting backward? 2 Answers
Projectile Firing/Gun script 1 Answer
Top down 2d shooting - XZ rotation 0 Answers