Wiki

Case Status
Log In

Wiki

 
Home ยป Action Reference»Physics 2d Actions»Line Cast 2d
Index
Navigation
Community Wiki

Line Cast 2d

Casts a Ray against all Colliders in the scene.A linecast is an imaginary line between two points in world space. Any object making contact with the beam can be detected and reported. This differs from the similar raycast in that raycasting specifies the line using an origin and direction.Use GetRaycastHit2dInfo to get more detailed info.

From Game Object
Start ray at game object position. Or use From Position parameter.
From Position
Start ray at a vector2 world position. Or use fromGameObject parameter. If both define, will add fromPosition to the fromGameObject position
To Game Object
End ray at game object position. Or use From Position parameter.
To Position
End ray at a vector2 world position. Or use fromGameObject parameter. If both define, will add toPosition to the ToGameObject position
Min Depth
Only include objects with a Z coordinate (depth) greater than this value. leave to none for no effect
Max Depth
Only include objects with a Z coordinate (depth) less than this value. leave to none
Hit Event
Event to send if the ray hits an object.
Store Did Hit
Set a bool variable to true if hit something, otherwise false.
Store Hit Object
Store the game object hit in a variable.
Store Hit Point
Get the 2d position of the ray hit point and store it in a variable.
Store Hit Normal
Get the 2d normal at the hit point and store it in a variable.
Store Hit Distance
Get the distance along the ray to the hit point and store it in a variable.
Repeat Interval
Set how often to cast a ray. 0 = once, don't repeat; 1 = everyFrame; 2 = every other frame... Since raycasts can get expensive use the highest repeat interval you can get away with.
Layer Mask
Pick only from these layers.
Invert Mask
Invert the mask, so you pick from all layers except those defined above.
Debug Color
The color to use for the debug line.
Debug
Draw a debug line. Note: Check Gizmos in the Game View to see it in game.

 

Tags:

Last modified on 3/14/2016 8:36 AM by User.

  • RSS Feed