Hello again gamedevers :) I'm trying to create a fairly simple FPS shooter game. Im using a Rigidbody
FPS Controller prefab from Unity
. I have a rifle model attached to that, with a further gameobject for the bullet spawn location on the rifle.
I can see in the Editor
, that the bulletSpawn
object already knows which way it's supposed to be facing (ie. Z axis
is pointing correct direction).
I've never really used Raycasts
before except mobile games to select an object on screen, but my head is telling me that this might be the best way to make realistic bullets.
I've been reading about, particularly this: http://answers.unity3d.com/questions/22800/raycast-shooting.html
It suggests to use Raycasts
and I understand how to call a ray from the bulletSpawn
and set it's direction, and to see what it hits.
But what I don't understand is how fast the ray will travel, and how to limit the speed of said ray.
I'm not sure if this is a good way to acheive the gunfire or whether it might be better to create Rigidbodies
and addforce()
to them.
You guys are always so helpful and often make things MUCH easier to understand that travelling through dozens of old posts and the docs which I cant always follow along with.
How to achieve this effect?