Worldprobe::getShapeTestResult: Difference between revisions
(yay) |
(yay) |
||
| Line 1: | Line 1: | ||
Parameters:<br>rayHandle - Ray Handle from a casted ray, as returned by CAST_RAY_POINT_TO_POINT<br>hit - Where to store whether or not it hit anything. False is when the ray reached its destination.<br>endCoords - Where to store the world-coords of where the ray was stopped (by hitting its desired max range or by colliding with an entity/the map)<br>surfaceNormal - Where to store the surface-normal coords (NOT relative to the game world) of where the entity was hit by the ray<br>entityHit - Where to store the handle of the entity hit by the ray<br><br>Returns:<br>Result? Some type of enum.<br><br>NOTE: To get the offset-coords of where the ray hit relative to the entity that it hit (which is NOT the same as surfaceNormal), you can use these two natives:<br>Vector3 offset = ENTITY::GET_OFFSET_FROM_ENTITY_GIVEN_WORLD_COORDS(entityHit, endCoords.x, endCoords.y, endCoords.z);<br>Vector3 entitySpotCoords = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(entityHit, offset.x, offset.y, offset.z);<br><br>Use ENTITY::GET_ENTITY_TYPE(entityHit) to quickly distinguish what type of entity you hit (ped/vehicle/object - 1/2/3) | Parameters:<br>rayHandle - Ray Handle from a casted ray, as returned by CAST_RAY_POINT_TO_POINT<br>hit - Where to store whether or not it hit anything. False is when the ray reached its destination.<br>endCoords - Where to store the world-coords of where the ray was stopped (by hitting its desired max range or by colliding with an entity/the map)<br>surfaceNormal - Where to store the surface-normal coords (NOT relative to the game world) of where the entity was hit by the ray<br>entityHit - Where to store the handle of the entity hit by the ray<br><br>Returns:<br>Result? Some type of enum.<br><br>NOTE: To get the offset-coords of where the ray hit relative to the entity that it hit (which is NOT the same as surfaceNormal), you can use these two natives:<br>Vector3 offset = ENTITY::GET_OFFSET_FROM_ENTITY_GIVEN_WORLD_COORDS(entityHit, endCoords.x, endCoords.y, endCoords.z);<br>Vector3 entitySpotCoords = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(entityHit, offset.x, offset.y, offset.z);<br><br>Use ENTITY::GET_ENTITY_TYPE(entityHit) to quickly distinguish what type of entity you hit (ped/vehicle/object - 1/2/3) | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="javascript">worldprobe.getShapeTestResult(rayHandle, hit, endCoords, surfaceNormal, entityHit);</syntaxhighlight> | <syntaxhighlight lang="javascript">mp.game.worldprobe.getShapeTestResult(rayHandle, hit, endCoords, surfaceNormal, entityHit);</syntaxhighlight> | ||
=== Required Arguments === | === Required Arguments === | ||
*'''rayHandle:''' int | *'''rayHandle:''' int | ||
| Line 12: | Line 12: | ||
==Example== | ==Example== | ||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
todo | // todo | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==See also== | ==See also== | ||
{{ | {{Worldprobe_s_function_c}} | ||
[[Category:Clientside API]] | [[Category:Clientside API]] | ||
[[Category:TODO: Example]] | [[Category:TODO: Example]] | ||
Latest revision as of 21:35, 6 May 2017
Parameters:
rayHandle - Ray Handle from a casted ray, as returned by CAST_RAY_POINT_TO_POINT
hit - Where to store whether or not it hit anything. False is when the ray reached its destination.
endCoords - Where to store the world-coords of where the ray was stopped (by hitting its desired max range or by colliding with an entity/the map)
surfaceNormal - Where to store the surface-normal coords (NOT relative to the game world) of where the entity was hit by the ray
entityHit - Where to store the handle of the entity hit by the ray
Returns:
Result? Some type of enum.
NOTE: To get the offset-coords of where the ray hit relative to the entity that it hit (which is NOT the same as surfaceNormal), you can use these two natives:
Vector3 offset = ENTITY::GET_OFFSET_FROM_ENTITY_GIVEN_WORLD_COORDS(entityHit, endCoords.x, endCoords.y, endCoords.z);
Vector3 entitySpotCoords = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(entityHit, offset.x, offset.y, offset.z);
Use ENTITY::GET_ENTITY_TYPE(entityHit) to quickly distinguish what type of entity you hit (ped/vehicle/object - 1/2/3)
Syntax
mp.game.worldprobe.getShapeTestResult(rayHandle, hit, endCoords, surfaceNormal, entityHit);
Required Arguments
- rayHandle: int
- hit: BOOL
- endCoords: Vector3
- surfaceNormal: Vector3
- entityHit: Entity handle or object
Return value
- object: hit, endCoords, surfaceNormal, entityHit
Example
// todo