A example implementation on how to use 2 raycasts to simulate weapon fire for a 3rd person shooter game. Upon weapon fire, it uses the camera-crosshair ray to first detect if the player's aim has a collision, then we shoot a 2nd ray from the gun to make sure the gun is able to hit that collision point.
[Looking for the code?]
👉 / batteryaciddev
👋 Let's talk shop 👇
[Helpful Unity Networking Assets] https://prf.hn/l/n0bZqOe
[Discord] / discord
[Twitter] / batteryaciddev
[Support the channel] https://www.getyourgamedone.com/chann...
----------------------------------------------------------------------------
00:00:00 3RD PERSON RAYCAST PROBLEM
00:00:33 PROPOSED SOLUTION
00:00:50 SOLUTION SETUP
00:01:23 GUN FIRE ORIGIN
00:01:40 RAYCAST COLLISION LAYER REFACTOR
00:02:17 AIM RAYCAST SETUP
00:03:20 GUN FIRE RAYCAST SETUP
00:04:45 FIRE RAYCAST QUERY
00:05:03 MOB COLLISION DETECTION
00:05:30 TWO RAYCAST DEMO
00:06:17 TWO RAYCAST ACCURACY
00:07:13 SOLUTION EXPLAINED & DEMO
00:08:38 ALTERNATIVE SOLUTIONS
00:09:06 DISCORD COMMUNITY
#3rdpersonshooter #raycast3d #gamedevelopment #3dmultiplayer #godotstartertemplate #godot #godottips #gametech #gamedev #indiedev #multiplayer #network #godotengine