- Home /
The question is answered, right answer was accepted
Object follow raycast
I'm trying to get an object/shield to follow my raycast. If you know any tutorials could you direct them to me, or explain to me another way I could execute this action:
For more information I'm trying to create an A.I. shield that keeps a perimeter around the player and when a raycast/gun is aimed at the player, the shield blocks the damage/trajectory for some time before dying.
Answer by Tu-Le · May 30, 2017 at 04:34 AM
not sure you mean but i think you want something fly to ray cast hit point? you can use raycasthit there are transform component, just move your shield element to that point.
Answer by ritoban · Jun 01, 2017 at 01:45 PM
Have the gun create a bullet gameobject and tell that bullet gameobject to travel (without interacting with gravity) with a certain velocity (which is the direction of your raycast). Make sure the bullet only collides with things that your raycast hits.