Tile - YPhysics - Raycast – Ylands
Jump to navigation
Jump to search
(Created page with "<!--- THIS PAGE WAS GENERATED AUTOMATICALLY; DO NOT EDIT IT, OTHERWISE YOUR CHANGES WILL BE LOST DURING FUTURE UPDATE. --> == Raycast(Origin, Direction, Max distance, On entit...") |
Lou Montana (talk | contribs) m (Text replacement - "{{DEFAULTSORT:{{#sub:{{PAGENAME}}|14}}}}" to "{{DEFAULTSORT:{{#sub:{{PAGENAME}}|7}}}}") |
||
(One intermediate revision by one other user not shown) | |||
Line 36: | Line 36: | ||
'''void''' Returns '''true''' if the ray intersects with a '''Collider''', otherwise '''false'''. | '''void''' Returns '''true''' if the ray intersects with a '''Collider''', otherwise '''false'''. | ||
=== Availability === | |||
[[Ylands:Tile Availability - Client|Client]], [[Ylands:Tile Availability - Server|Server]], [[Ylands:Tile Availability - Custom Controller|Custom Controller]] | |||
=== Description === | === Description === | ||
Line 48: | Line 52: | ||
---- | ---- | ||
{{Navbox/Ylands}} | {{Navbox/Ylands}} | ||
{{DEFAULTSORT:{{#sub:{{PAGENAME}}| | {{DEFAULTSORT:{{#sub:{{PAGENAME}}|7}}}} | ||
[[Category: Instructions]] | [[Category: Instructions]] |
Latest revision as of 14:27, 24 November 2023
Raycast(Origin, Direction, Max distance, On entity hit, On ground hit, On missed)
static raycast(origin: YVector3, direction: YVector3, maxDistance: number, onEntityHit: (entity: YEntity, hitPosition: YVector3, hitNormal: YVector3) => void, onGroundHit: (hitPosition: YVector3, hitNormal: YVector3) => void, onMissed: () => void): void;
Parameters
origin
The starting point of the ray in world coordinates.
direction
The direction vector of the ray.
maxDistance
The maximum distance the ray should check for collisions.
onEntityHit
Called when the ray collides with an entity.
onGroundHit
Called when the ray collides with the terrain.
onMissed
Called when the ray doesn't collide with anything in the length of it's max distance parameter.
Returns
void Returns true if the ray intersects with a Collider, otherwise false.
Availability
Client, Server, Custom Controller
Description
Casts a ray, from origin point, in a direction, of a maximal length, against all colliders in the Scene.
Notes
- To get a Direction Vector parameter, use Vector(TransformPosition(Target) - TransformPosition(Origin)).