Worldprobe::castRayPointToPoint: Difference between revisions
(yay) |
(yay) |
||
| Line 1: | Line 1: | ||
Not sure how or why this differs from 0x7EE9F5D83DD4F90E, but it does.<br><br>This function casts a ray from Point1 to Point2 and returns it's ray handle. A simple ray cast will 'shoot' a line from point A to point B, and return whether or not the ray reached it's destination or if it hit anything and if it did hit anything, will return the handle of what it hit (entity handle) and coordinates of where the ray reached.<br><br>You can use _GET_RAYCAST_RESULT to get the result of the raycast<br><br>Entity is an entity to ignore, such as the player.<br><br>Flags are intersection bit flags. They tell the ray what to care about and what not to care about when casting. Passing -1 will intersect with everything, presumably.<br><br>Flags:<br>1: Intersect with map<br>2: Intersect with vehicles (used to be mission entities?) (includes train)<br>4: Intersect with peds? (same as 8)<br>8: Intersect with peds? (same as 4)<br>16: Intersect with objects<br>32: Unknown<br>64: Unknown<br>128: Unknown<br>256: Intersect with vegetation (plants, coral. trees not included)<br><br>NOTE: Raycasts that intersect with mission_entites (flag = 2) has limited range and will not register for far away entites. The range seems to be about 30 metres. | Not sure how or why this differs from 0x7EE9F5D83DD4F90E, but it does.<br><br>This function casts a ray from Point1 to Point2 and returns it's ray handle. A simple ray cast will 'shoot' a line from point A to point B, and return whether or not the ray reached it's destination or if it hit anything and if it did hit anything, will return the handle of what it hit (entity handle) and coordinates of where the ray reached.<br><br>You can use _GET_RAYCAST_RESULT to get the result of the raycast<br><br>Entity is an entity to ignore, such as the player.<br><br>Flags are intersection bit flags. They tell the ray what to care about and what not to care about when casting. Passing -1 will intersect with everything, presumably.<br><br>Flags:<br>1: Intersect with map<br>2: Intersect with vehicles (used to be mission entities?) (includes train)<br>4: Intersect with peds? (same as 8)<br>8: Intersect with peds? (same as 4)<br>16: Intersect with objects<br>32: Unknown<br>64: Unknown<br>128: Unknown<br>256: Intersect with vegetation (plants, coral. trees not included)<br><br>NOTE: Raycasts that intersect with mission_entites (flag = 2) has limited range and will not register for far away entites. The range seems to be about 30 metres. | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="javascript">worldprobe.castRayPointToPoint(x1, y1, z1, x2, y2, z2, flags, entity, p8);</syntaxhighlight> | <syntaxhighlight lang="javascript">mp.game.worldprobe.castRayPointToPoint(x1, y1, z1, x2, y2, z2, flags, entity, p8);</syntaxhighlight> | ||
=== Required Arguments === | === Required Arguments === | ||
*'''x1:''' float | *'''x1:''' float | ||
| Line 16: | Line 16: | ||
==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
Not sure how or why this differs from 0x7EE9F5D83DD4F90E, but it does.
This function casts a ray from Point1 to Point2 and returns it's ray handle. A simple ray cast will 'shoot' a line from point A to point B, and return whether or not the ray reached it's destination or if it hit anything and if it did hit anything, will return the handle of what it hit (entity handle) and coordinates of where the ray reached.
You can use _GET_RAYCAST_RESULT to get the result of the raycast
Entity is an entity to ignore, such as the player.
Flags are intersection bit flags. They tell the ray what to care about and what not to care about when casting. Passing -1 will intersect with everything, presumably.
Flags:
1: Intersect with map
2: Intersect with vehicles (used to be mission entities?) (includes train)
4: Intersect with peds? (same as 8)
8: Intersect with peds? (same as 4)
16: Intersect with objects
32: Unknown
64: Unknown
128: Unknown
256: Intersect with vegetation (plants, coral. trees not included)
NOTE: Raycasts that intersect with mission_entites (flag = 2) has limited range and will not register for far away entites. The range seems to be about 30 metres.
Syntax
mp.game.worldprobe.castRayPointToPoint(x1, y1, z1, x2, y2, z2, flags, entity, p8);
Required Arguments
- x1: float
- y1: float
- z1: float
- x2: float
- y2: float
- z2: float
- flags: int
- entity: Entity handle or object
- p8: int
Return value
- int
Example
// todo