playMaker

Author Topic: 2D Ricochet Viewer  (Read 244 times)

Ravencroft

  • Playmaker Newbie
  • *
  • Posts: 7
2D Ricochet Viewer
« on: October 31, 2023, 07:41:07 AM »
I'm trying to figure out the best way to draw a bullet ricochet prediction line. Please let me know if you have a better way of doing this other than what I am trying below.

Currently have the bullet Spawn point rotate to look at towards the mouse. I have a child called Bounce1 attached to Spawn. I set off a 2d raycast from spawn and collect the distance then move Bounce1 to that distance. This way Bounce1 is on the object the raycast is hitting. The issue I am now running into is rotating Bounce1 to the reflection of the raycast. I am currently collection Distance and Normal from the raycast. I don't believe I can do a Quaternion as I don't have a moving direction of Bounce1 since I SetPos2d with the distance to move it.

Any advice would be helpful. Image below shows the redline raycast and Bounce1 is the green box you can see hitting the side of the object.