Author Topic: Steps used for Raycast to add force to 3d object?  (Read 476 times)


  • Full Member
  • ***
  • Posts: 215
    • View Profile
Steps used for Raycast to add force to 3d object?
« on: July 04, 2018, 09:55:54 AM »
Can someone give me a list of *all* of the actions needed to have a raycast based gun hit a physics object and knock it like a bullet impact? Please don't just say 'use add force'. I know things in that vague way but can't get the details right.

I've already got a raycast set up for a Steam VR game, which is casting out of a cube located in my gun barrel. This raycasting is already being used to move an invisible sphere (which I'm using to detect collisions to trigger events when you are aiming at things) and I have also set up a dust particle that is created with the correct rotation to look like you are shooting surfaces.

But how do I do that add force properly?

1) Have raycast
2) Store the hit object
3) Store the hit normal??
4) Use an Add Force action which points to the stored hit object
5) .... what else? How/where do I insert the direction the object should push to?
6) How/where do I set how much force is actually imparted on to the hit object?