Entity::setNoCollision: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
m (Replaced HTML with template)
Line 1: Line 1:
Calling this function, regardless of the 'unknown' value, disabled collision between two entities.<br><br>Importance of entity1 and 2 order is unclear.
Calling this function, regardless of the 'unknown' value, disabled collision between two entities.<br><br>Importance of entity1 and 2 order is unclear.
==Syntax==
==Syntax==
<syntaxhighlight lang="javascript">entity.setNoCollision(entity2, collision);</syntaxhighlight>
<pre>entity.setNoCollision(entity2, collision);</pre>
 
=== Required Arguments ===
=== Required Arguments ===
*'''entity2:''' '''Entity handle'''
*'''entity2:''' '''Entity handle'''
Line 11: Line 13:


==Example==
==Example==
<div class="header" style="background-color: #AE4040; color: #FFFFFF; border: 2px solid #408DAE;">
{{ClientsideCode|
<div style="margin: 10px 10px 10px 10px;"><b>Client-Side</b></div>
<pre>
<syntaxhighlight lang="javascript">
mp.events.add('enableCollisions', () => {
mp.events.add('enableCollisions', () => {
mp.players.forEach(player => {
mp.players.forEach(player => {
Line 21: Line 22:
});
});
});
});
mp.events.add('disableCollisions', () => {
mp.events.add('disableCollisions', () => {
mp.players.forEach(player => {
mp.players.forEach(player => {
Line 28: Line 30:
});
});
});
});
</syntaxhighlight>
</pre>
</div>
}}
 
==See also==
==See also==
{{Entity_function_c}}
{{Entity_function_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]

Revision as of 13:21, 26 October 2018

Calling this function, regardless of the 'unknown' value, disabled collision between two entities.

Importance of entity1 and 2 order is unclear.

Syntax

entity.setNoCollision(entity2, collision);

Required Arguments

  • entity2: Entity handle
  • collision: Boolean
    • false = no collison, true = enabled collisions

Return value

  • Undefined

Example

Client-Side
mp.events.add('enableCollisions', () => {
	mp.players.forEach(player => {
		mp.players.local.vehicle.setNoCollision(player.vehicle.handle, true);
		player.vehicle.setAlpha(255);
		player.setAlpha(255);
	});
});

mp.events.add('disableCollisions', () => {
	mp.players.forEach(player => {
		mp.players.local.vehicle.setNoCollision(player.vehicle.handle, false);
		player.vehicle.setAlpha(102);
		player.setAlpha(255);
	});
});

See also