Colshape::isPointWithin: Difference between revisions

From RAGE Multiplayer Wiki
m (Added example)
mNo edit summary
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:


{{ServersideJsFunction}}
Checking if a point is within the colshape.
Checking if a point is within the colshape.
==Parameters==
==Parameters==
* '''position: <span style="color:#008017>Vector3</span>'''  
* '''position:''' {{RageType|Vector3}}


==Syntax==
==Syntax==
<div class="header" style="background-color: #408DAE; color: #FFFFFF; border: 2px solid #408DAE;">
{{ServersideCode|
<div style="margin: 10px 10px 10px 10px;"><b>Server-Side</b></div>
<pre>
<syntaxhighlight lang="javascript">
Boolean colshape.isPointWithin(position);
colshape.isPointWithin(position);
</pre>
</syntaxhighlight>
}}
</div>


== Example ==
== Example ==
<source lang="javascript">
{{ServersideCode|
<pre>
let position = player.position;
let position = player.position;
if (colshape.isPointWithin(position)) {
if (colshape.isPointWithin(position)) {
Line 20: Line 21:
     console.log("Outside Colshape");
     console.log("Outside Colshape");
}
}
</source>
</pre>
}}




==See Also==
==See Also==
{{Colshapes_function}}
{{Colshapes_function}}
[[Category:ColShape API]]
[[Category:Server-side Function]]

Latest revision as of 13:02, 21 November 2021

Server-Side
Function

 JavaScript



Checking if a point is within the colshape.

Parameters

  • position: Vector3

Syntax

Server-Side
Boolean colshape.isPointWithin(position);

Example

Server-Side
let position = player.position;
if (colshape.isPointWithin(position)) {
    console.log("Inside Colshape");
} else {
    console.log("Outside Colshape");
}


See Also