#gun shoot code not working

8 messages · Page 1 of 1 (latest)

hardy snow
#

If you want to move the bullet you instantiated, you actually have to get the Rigidbody on that instantiated object.
Referencing an arbitrary bulletRb won't get you anywhere.

And why is there an OnCollisionEnter method on the gun?

#

Also, why would the delay be working?
You are literally setting canShoot to true every time before you check it...

digital mirage
#

@hardy snow You are correct about the Shooting, but I think the bullet should move ( the implementation is incorrect but it should move) as the above code is applying an impulse force.

#

Most probably your bullet is colliding with your player collider and stopping itself, can you check if the layers are set correctly?

hardy snow
digital mirage
#

ForceMode is impulse

#

Oh I see

#

he isn't updating his bulletRB ref