- Home /
Help me! I cant aim properly
Hi everyone, i just need ur help. I am making a FPS and I add a weapon and some sparks but when i play the game and I shoot the sparks hit far away from where it should hit.
P.S: im using a tutorial from unity 3d downloaded from unity3d.
Answer by Jason_DB · Feb 14, 2011 at 01:15 AM
It's probably because the gun isn't lined up properly. To fix that just make sure the object with the gun script is a child of the main camera, and then set its position and rotation to (0, 0, 0).
Another thing that I've found helpful is a "draw ray" script, which basically draws a line showing where a gameobject is pointing. Try dragging this script onto your gun and turning on 'gizmos' in the game view; the red line should show exactly where the gun is pointing ( so you can use that to aim it).
var needsSelection : boolean = false;
function OnDrawGizmosSelected () { if(needsSelection){ Gizmos.color = Color.red; direction = transform.TransformDirection (Vector3.forward) *50000; Gizmos.DrawRay (transform.position, direction); } }
function OnDrawGizmos () { if(!needsSelection){ Gizmos.color = Color.red; direction = transform.TransformDirection (Vector3.forward) *50000; Gizmos.DrawRay (transform.position, direction);
}
}
Thanks DatardlyBanana, i was following ur tutorial when this little problem appeared. Anyway i quittted making videogames cause my computers was to laggy and it froze from time to time. Thank u again and i hope this answer can be useful to other people!!!!
Answer by Ed 1 · Jan 16, 2011 at 05:48 PM
The weapons parent object need to be in the same place as the weapon otherwise it will fire towards the wrong place. Also you may not have a long enough range as thats one of the variables you can set.
I add a machine gun to my FPS and to simulate the shot i put a particle animator in front of the muzzle_flash of the machinegun. In the scene view it is all ok but in the game view no. Also my crosshair is also rotate the same degrees as the shot.
Your answer
Follow this Question
Related Questions
Shooter in iOS and a visible Aim line before shooting 0 Answers
Why are my guns shooting lower when my character moves forward? 1 Answer
Best way for setting up shooting mechanics for an FPS? (iPhone) 1 Answer
first Gun fires not well 2 Answers
Bullets follow mouse after shooting in Sidescroller 1 Answer