- Home /
Transform.position bullet won't align
I am creating an fps, and I am using:
var projectile = Instantiate(shot, transform.position, Quaternion.identity); projectile.rigidbody.AddForce(transform.right
* 2000); print(transform.position);
the script is attached to the gun, the problem is that I want the bullet to originate from the barrel so I can change its flight path, instead it starts from 0.0 of the gun, how do I change this?
Cheers, Joe.
Answer by Dracorat · Apr 17, 2013 at 04:53 PM
Make an empty game object called something like "BulletSpawnPoint" and then manually place that at the end of the barrel. Make sure that object is a child of the gun.
Spawn the bullet from that object instead of from the gun object directly.
Your answer
Follow this Question
Related Questions
Dart/Bullet comes out pointing up 1 Answer
Gun problem : Force of bullet must be really high to work, but it is affecting character 2 Answers
How do i make a fps where the gun always shoots realisticly 3 Answers
Which is better, shooting a bullet from camera or from the gun itself? 3 Answers
Bullet Collision Issues 1 Answer