Tile - YPhysics - Raycast Terrain – Ylands

From Bohemia Interactive Community
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 Terrain(Origin, Direction, Max distance,...")
 
No edit summary
Line 32: Line 32:


'''void''' Returns '''true''' if the ray intersects with the '''Terrain''', otherwise '''false'''.
'''void''' Returns '''true''' if the ray intersects with the '''Terrain''', otherwise '''false'''.
=== Availability ===
[[Ylands:Tile Availability - Client|Client]], [[Ylands:Tile Availability - Server|Server]], [[Ylands:Tile Availability - Custom Controller|Custom Controller]]


=== Description ===
=== Description ===

Revision as of 12:17, 12 November 2021

Raycast Terrain(Origin, Direction, Max distance, On ground hit, On missed)

YlandsTile-752.png

static raycastTerrain(origin: YVector3, direction: YVector3, maxDistance: number, 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.

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 the Terrain, otherwise false.

Availability

Client, Server, Custom Controller

Description

Casts a ray, from origin point, in a direction, of a maximal length, against the terrain colliders of the scene.

Notes

  • To get a Direction Vector parameter, use Vector(TransformPosition(Target) - TransformPosition(Origin)).