GwNavQueries - stingray.GwNavQueries namespace reference - Stingray Lua API Reference

stingray.GwNavQueries namespace reference

Description

Provides access to the various operations we can perform on the NavMesh (e.g. raycast).

Functions

Parameters

query_output :

stingray.GwNavQueryDynamicOutput

The GwNavQueryDynamicOutput object you want to destroy.

Returns
This function does not return any values.

Beware that all objects accessed from NavQueryDynamicOutput _could_ be destroyed when destroy_query_dynamic_output is called

Parameters

database_or_world :

any(stingray.GwNavWorld, stingray.GwNavDatabase)

The GwNavDatabase to run the query onto. If a GwNavWorld, the default GwNavDatabase will be used.

The any(...) notation indicates that this item may be an instance of any of the types shown in the parentheses.

A :

stingray.Vector3

The center position from which we wish to start.

B :

stingray.Vector3

The center position at which the cast ends.

radius :

number

The disk radius.

logic :

stingray.GwNavTraverseLogicData?

The GwNavTraverseLogicData to use for this query.

The ? notation indicates that this type is optional: there may be zero or one instances of it.
Returns

boolean

true if the disk successfully arrives.

Parameters

database_or_world :

any(stingray.GwNavWorld, stingray.GwNavDatabase)

The GwNavDatabase to run the query onto. If a GwNavWorld, the default GwNavDatabase will be used.

The any(...) notation indicates that this item may be an instance of any of the types shown in the parentheses.

A :

stingray.Vector3

The center position from which we wish to start.

radius :

number

The disk radius.

normalized_move_2d :

stingray.Vector2

The direction to cast the disk.

distance :

number

The distance of the cast.

logic :

stingray.GwNavTraverseLogicData?

The GwNavTraverseLogicData to use for this query.

The ? notation indicates that this type is optional: there may be zero or one instances of it.
Returns

boolean

true if the disk successfully moved of the given distance.

stingray.Vector3

The center position of the disk when the cast ended.

stingray.Vector3

The collision position on the disk if the disk collided.

Also returns the last valid center position, and the colliding position if any.

Parameters

database_or_world :

any(stingray.GwNavWorld, stingray.GwNavDatabase)

The GwNavDatabase to run the query onto. If a GwNavWorld, the default GwNavDatabase will be used.

The any(...) notation indicates that this item may be an instance of any of the types shown in the parentheses.

position :

stingray.Vector3

The position outside the NavMesh.

above_dist :

number?

The distance above the position we wish to search in meters.

The ? notation indicates that this type is optional: there may be zero or one instances of it.

below_dist :

number?

The distance below the position we wish to search in meters.

The ? notation indicates that this type is optional: there may be zero or one instances of it.

horizontal_dist :

number?

The distance horizontally from the position we wish to search in meters.

The ? notation indicates that this type is optional: there may be zero or one instances of it.

distance_from_obstacle :

number?

The distance we will move the point from the border of the Navmesh.

The ? notation indicates that this type is optional: there may be zero or one instances of it.

logic :

stingray.GwNavTraverseLogicData?

The GwNavTraverseLogicData to use for this query.

The ? notation indicates that this type is optional: there may be zero or one instances of it.
Returns

stingray.Vector3?

nil if no position was found within the NavMesh. Otherwise, the position itself.

The ? notation indicates that this type is optional: there may be zero or one instances of it.
Parameters

database_or_world :

any(stingray.GwNavWorld, stingray.GwNavDatabase)

The GwNavDatabase to run the query onto. If a GwNavWorld, the default GwNavDatabase will be used.

The any(...) notation indicates that this item may be an instance of any of the types shown in the parentheses.

position :

stingray.Vector3

The position from which we wish to start.

velocity :

stingray.Vector3

The velocity with which we wish to move.

delta_time :

number

The delta time in seconds since the last frame.

logic :

stingray.GwNavTraverseLogicData?

The GwNavTraverseLogicData to use for this query.

The ? notation indicates that this type is optional: there may be zero or one instances of it.
Returns

stingray.Vector3

The position on the NavMesh.

In the event that no position can be found, the input position is returned. Typically useful to move something without physics.

Parameters

query_output :

stingray.GwNavQueryDynamicOutput

The GwNavQueryDynamicOutput object whose TagVolume you want to retrieve.

index :

integer

The index of the TagVolume you want to retrieve.

Returns

stingray.GwNavTagVolume

The TagVolume with the specified index.

Beware that this GwNavTagVolume could be destroyed when NavQueryDynamicOutput.destroy() is called

Parameters

query_output :

stingray.GwNavQueryDynamicOutput

The GwNavQueryDynamicOutput object whose TagVolumes you want to test.

Returns

integer

The number of TagVolumes found by the query.

Parameters

database_or_world :

any(stingray.GwNavWorld, stingray.GwNavDatabase)

The GwNavDatabase to run the query onto. If a GwNavWorld, the default GwNavDatabase will be used.

The any(...) notation indicates that this item may be an instance of any of the types shown in the parentheses.

A :

stingray.Vector3

The position from which we wish to start.

B :

stingray.Vector3

The position at which the cast ends.

logic :

stingray.GwNavTraverseLogicData?

The GwNavTraverseLogicData to use for this query.

The ? notation indicates that this type is optional: there may be zero or one instances of it.
Returns

boolean

true if the ray successfully arrives.

Parameters

database_or_world :

any(stingray.GwNavWorld, stingray.GwNavDatabase)

The GwNavDatabase to run the query onto. If a GwNavWorld, the default GwNavDatabase will be used.

The any(...) notation indicates that this item may be an instance of any of the types shown in the parentheses.

A :

stingray.Vector3

The position from which the ray begins.

move_2d :

stingray.Vector2

The 2d relative move to cast.

logic :

stingray.GwNavTraverseLogicData?

The GwNavTraverseLogicData to use for this query.

The ? notation indicates that this type is optional: there may be zero or one instances of it.
Returns

boolean

true if the ray successfully moved of the given distance.

stingray.Vector3

The position along the ray that was hit (the end point if there was no hit).

Also returns the last valid position along the ray

Parameters

database_or_world :

any(stingray.GwNavWorld, stingray.GwNavDatabase)

The GwNavDatabase to run the query onto. If a GwNavWorld, the default GwNavDatabase will be used.

The any(...) notation indicates that this item may be an instance of any of the types shown in the parentheses.

A :

stingray.Vector3

The position from which the ray begins.

B :

stingray.Vector3

The position from which the ray ends.

Returns

boolean

true if the ray successfully reached b.

stingray.Vector3

The position along the ray that was hit (the end point if there was no hit).

Also returns the last valid position along the ray

Parameters

database_or_world :

any(stingray.GwNavWorld, stingray.GwNavDatabase)

The GwNavDatabase to run the query onto. If a GwNavWorld, the default GwNavDatabase will be used.

The any(...) notation indicates that this item may be an instance of any of the types shown in the parentheses.

position :

stingray.Vector3

The position outside the NavMesh.

above :

number?

The limit above the position we wish to search in meters.

The ? notation indicates that this type is optional: there may be zero or one instances of it.

below :

number?

The limit below the position we wish to search in meters.

The ? notation indicates that this type is optional: there may be zero or one instances of it.
Returns

stingray.GwNavQueryDynamicOutput?

nil or a newly created GwNavQueryDynamicOutput if there's at least one tagvolume which will have to be destroyed by user with stingray.GwNavQueries.destroy_query_dynamic_output

The ? notation indicates that this type is optional: there may be zero or one instances of it.
Parameters

database_or_world :

any(stingray.GwNavWorld, stingray.GwNavDatabase)

The GwNavDatabase to run the query onto. If a GwNavWorld, the default GwNavDatabase will be used.

The any(...) notation indicates that this item may be an instance of any of the types shown in the parentheses.

position :

stingray.Vector3

The position at which we wish to search.

above :

number

The limit above the position we wish to search in meters.

below :

number

The limit below the position we wish to search in meters.

Returns

number?

If a triangle is found, this indicates the altitude of the projection of the input position onto the plane of the triangle. Otherwise, nil.

The ? notation indicates that this type is optional: there may be zero or one instances of it.

stingray.Vector3?

If a triangle is found, this indicates the first vertex of the triangle. Otherwise, nil.

The ? notation indicates that this type is optional: there may be zero or one instances of it.

stingray.Vector3?

If a triangle is found, this indicates the second vertex of the triangle. Otherwise, nil.

The ? notation indicates that this type is optional: there may be zero or one instances of it.

stingray.Vector3?

If a triangle is found, this indicates the third vertex of the triangle. Otherwise, nil.

The ? notation indicates that this type is optional: there may be zero or one instances of it.