RaycastManager
Summary
Methods
Method |
Returns |
GetEntityInRaycast(distance: float) |
Entity | nil |
Raycast(from: Vec3, to: Vec3, flags: RayCastFlags) |
RayCastHit | nil |
SpatialRaycast(from: Vec3, to: Vec3, flags: SpatialQueryFlags) |
Entity{} |
DetailedRaycast(from: Vec3, to: Vec3, maxHits: int, materialFlags: MaterialFlags, flags: RayCastFlags) |
RayCastHit{} |
CollisionRaycast(from: Vec3, to: Vec3, maxHits: int, materialFlags: MaterialFlags, flags: RayCastFlags) |
RayCastHit{} |
Methods
GetEntityInRaycast
GetEntityInRaycast(distance: float): Entity | nil
It is using the client camera transform as a base.
Parameters
Name |
Type |
Description |
distance |
float |
|
Returns
Raycast
Raycast(from: Vec3, to: Vec3, flags: RayCastFlags): RayCastHit | nil
Parameters
Returns
Example
Events:Subscribe('UpdateManager:Update', function(deltaTime, updatePass)
if updatePass ~= UpdatePass.UpdatePass_PreSim then
return
end
local rayCastHit = RaycastManager:Raycast(Vec3(0, 0, 0), Vec3(1, 0, 0), RayCastFlags.DontCheckWater)
if rayCastHit == nil then
return
end
-- Do something with the rayCastHit here
end)
SpatialRaycast
SpatialRaycast(from: Vec3, to: Vec3, flags: SpatialQueryFlags): Entity{}
Parameters
Returns
DetailedRaycast
DetailedRaycast(from: Vec3, to: Vec3, maxHits: int, materialFlags: MaterialFlags, flags: RayCastFlags): RayCastHit{}
Parameters
Returns
CollisionRaycast
CollisionRaycast(from: Vec3, to: Vec3, maxHits: int, materialFlags: MaterialFlags, flags: RayCastFlags): RayCastHit{}
Parameters
Returns