Skip to content

Raycast and detects nearest object within a spotlight cone

Notifications You must be signed in to change notification settings

shadowlenz/SpotLight.RayCast

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

SpotLight.RayCast

Raycast and detects nearest object within a spotlight cone

alt text

Can detect if spotlight Light component is in the gameobject. Some values such as detectAngle or distance will be locked and be based on spotlight values.

  • Detect Layer: layers it'll grab the closest to.

  • Obsticle Mask Layer: detected go will be ignored if these layers are in front.

  • Detect Facing:

    • Transform Facing: Origin starts at this transform and using it's forward vector.
    • Cam Lock Transform Facing: Origin starts at Main Camera and using it's forward vector. However the yaw will be locked to avoid looking up or down.
    • Cam Forward: Origin starts at Main Camera and using it's forward vector.
  • Detect Distance: Distance to detect initialy.

  • Lost Distance: Target fully forget past this point if target travels too far away.

  • Detect Angle: Cone spread to detect.

  • Sight Height: Offset height of origin and target.

  • Target Height: Offset height of target.

  • Update Ticker: Per second refresh. Optimization to avoid raycasting every frame.

//results//

  • In Sight Target: (GameObject) Target is in sight, but dissapears with obsticles or not within the cone.
  • Detect Target: (GameObject) Recent target will stay in memory, regardless of obsticles or out of cone. Will dissapear if target is out of 'Lost Distance' value.
  • Dist Target: (float)Distance value of detected target.

Free to use. Please mention my name "Eugene Chu" twitter: @LenZ_Chu if you can ;3 https://twitter.com/LenZ_Chu

About

Raycast and detects nearest object within a spotlight cone

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages