Raycast Shooter + Handlers

v1.0

RaycastShooter.cs can be added to Projectiles that deal with raycasts, such as lasers. Check the demo scene lasers to see how this is used.

All components in this and child objects which implement IHandleRaycasts will be included as handlers, and will be given the information they need to potentially act.

Origin & Offset

This determines where the Raycast will begin, often it will be the parent objects Transform. Max Distance determines how far the Raycast will travel.

Raycast Interval

A value of -1 means the Raycast will fire every frame. Otherwise, it will fire periodically.

Max Shots

A value of -1 means unlimited shots. Otherwise, the Raycast will fire a set number of times, an no more.

Start Delay

This will delay the first Raycast check. This is useful for Projectiles where there is a warmup period before the projectile is "on" in the game.

Include Inactive Handlers

When true, IHandleRaycasts on inactive objects will be included in the handler list. This is often desired, as some child objects may not be turned on right away, but still need to act based on the Raycast results.

IHandleRaycast Classes

Any class which implements IHandleRaycast will be used as a handler of RaycastShooter.cs if it is a child of that object, and will get the Hit information from the raycast.

Collision At Raycast Hit Point

CollisionAtRaycastHitPoint.cs will trigger a Collision on all objects within a specified radius, from the Projectile set in the component.

Set Position From Raycast

SetPositionFromRaycast.cs will set the position of an object based on the Raycast Hit data. This is useful for positioning things like an "impact" particle at the end of a Raycast.

This does not have to be placed on the object being positioned! If you add this to another object, you can specify another object to be positioned, and can optionally turn on that object only when it is positioned, which may be a more desirable result.

Line Renderer Length

LineRendererLength.cs will set the position and length of a LineRenderer by the Raycast Hit. There are additional options to help draw the line appropriately for the length.

Line Renderer Length and Oscillation

LineRendererLengthAndOscillation.cs derives from LineRendererLength.cs and adds some oscillation effects. It was made specifically for the integration with Sci-Fi Effects by FORGE3D, but will work with other similar particles.

Line Renderer Frame Animation

LineRendererFrameAnimation.cs was made specifically for the integration with Sci-Fi Effects by FORGE3D. It will animate a LineRenderer while using the Raycast Hit to determine the position of the line.

Create your own IHandleRaycasts classes!

You can create your own classes which implement IHandleRaycasts and use them in conjuction with the Raycast Shooter to enable new features and functionality specific to your project.

Last updated