LineTrace: Difference between revisions
From Onset Developer Wiki
Created page with "{{Info|Function|Client|1.0}} {{FuncDescription|__EDIT_ME__}} {{FuncSyntax|LineTrace(sX, sY, sZ, eX, eY, eZ [, complex])}} {{FuncParameters}} {{FuncParam|sX|__EDIT_ME__}} {{..." |
No edit summary |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{Info|Function|Client|1.0}} | {{Info|Function|Client|1.0}} | ||
{{FuncDescription| | {{FuncDescription|Trace a line through the specified coordinates and return the [[HitType]] entity type, identifier and the impact coordinates.}} | ||
{{FuncSyntax|LineTrace(sX, sY, sZ, eX, eY, eZ [, complex])}} | {{FuncSyntax|LineTrace(sX, sY, sZ, eX, eY, eZ [, complex])}} | ||
{{FuncParameters}} | {{FuncParameters}} | ||
{{FuncParam|sX| | {{FuncParam|sX|The start X axis}} | ||
{{FuncParam|sY| | {{FuncParam|sY|The start Y axis}} | ||
{{FuncParam|sZ| | {{FuncParam|sZ|The start Z axis}} | ||
{{FuncParam|eX| | {{FuncParam|eX|The end X axis}} | ||
{{FuncParam|eY| | {{FuncParam|eY|The end Y axis}} | ||
{{FuncParam|eZ | | {{FuncParam|eZ |The end Z axis}} | ||
{{FuncParamOptional|complex| | {{FuncParamOptional|complex|Whether to trace for complex collision, default: '''false'''.}} | ||
{{FuncReturnValue| | {{FuncReturnValue|[[HitType|Hit entity type]], Hit entity id, impact X, Y, Z and impact normals X, Y, Z.}} | ||
== Example == | == Example == | ||
<syntaxhighlight lang="Lua"> | |||
local hittype, hitid, impactX, impactY, impactZ = LineTrace(startX, startY, startZ, endX, endY, endZ, false) | |||
</syntaxhighlight> | |||
{{RelatedFunctions}} | {{RelatedFunctions}} | ||
*[[LineTrace]] | |||
*[[createtable_ex]] | |||
*[[GetCameraFoV]] | |||
*[[SetCameraFoV]] | |||
*[[Random]] | |||
*[[RandomFloat]] | |||
*[[Base64Encode]] | |||
*[[Base64Decode]] | |||
*[[GetDistance2D]] | |||
*[[GetDistance3D]] | |||
*[[GetDistanceSquared3D]] | |||
*[[Lerp]] | |||
*[[LerpVector]] | |||
*[[VectorToRotation]] | |||
*[[RotationToVector]] | |||
*[[NormalizeVector]] | |||
*[[IsFloatNearlyZero]] | |||
*[[RandomUnitVectorInCone]] | |||
*[[RandomUnitVectorInEllipticalCone]] | |||
*[[UpdateStreamingLevels]] |
Latest revision as of 20:35, 30 August 2020
Description
Trace a line through the specified coordinates and return the HitType entity type, identifier and the impact coordinates.
Syntax
LineTrace(sX, sY, sZ, eX, eY, eZ [, complex])
Parameters
- sX
The start X axis - sY
The start Y axis - sZ
The start Z axis - eX
The end X axis - eY
The end Y axis - eZ
The end Z axis - complex (optional)
Whether to trace for complex collision, default: false.
Return Value
- Hit entity type, Hit entity id, impact X, Y, Z and impact normals X, Y, Z.
Example
local hittype, hitid, impactX, impactY, impactZ = LineTrace(startX, startY, startZ, endX, endY, endZ, false)
See also
- LineTrace
- createtable_ex
- GetCameraFoV
- SetCameraFoV
- Random
- RandomFloat
- Base64Encode
- Base64Decode
- GetDistance2D
- GetDistance3D
- GetDistanceSquared3D
- Lerp
- LerpVector
- VectorToRotation
- RotationToVector
- NormalizeVector
- IsFloatNearlyZero
- RandomUnitVectorInCone
- RandomUnitVectorInEllipticalCone
- UpdateStreamingLevels