User Tools

Site Tools


blog:160222_laser-pew-pew

160222 - Laser Pew Pew

Next up on my to-do list is weapons. I figure the best to start with is some sort of raycast weapon, so I'll be creating a basic laser weapon. Here's how it's gonna work:

  • I first make a quick raycast straight out from the camera along the Z axis (“through” the reticule) to find a point to raycast to
  • Next, raycast from the barrel of the laser weapon to the point we just found in the last cast, checking to see if we hit anything with the laser beam
  • Draw a “laser” from point to point along the second raycast, and apply damage to whatever got hit.
    • Damage will come into play with the health system I'll add later. For now, a simple SendMessage should work just fine (since that'll get ignored without crashing or anything)

The only thing I'm worried about with this is that the laser might look funny if the point at which we're targeting is right in the face of the mech. Might be worth implementing a minimum range for the laser to fire, but we'll see. Best to implement it first and see how much it sucks, if at all.

blog/160222_laser-pew-pew.txt · Last modified: 2016/02/22 09:03 by admin