Vector3::divide

From RAGE Multiplayer Wiki
Jump to navigation Jump to search

This function is used to divide a Vector3 by another Vector3 or scalar.

Syntax

vector.divide(Vector3 otherVec);
vector.divide(number scalar);

Required Arguments

  • otherVec: Vector3: The vector or scalar to divide the callee by.

Returns

  • Vector3 The quotient.

Example #1

Server-Side
const vec1 = new mp.Vector3(50, 10, 30);
const vec2 = new mp.Vector3(10, 20, 15);

const quotient = vec1.divide(vec2); // quotient = {x: 5, y: 2, z: 2}


Example #2

Server-Side
const vec1 = new mp.Vector3(50, 40, 30);
const scalar = 10;

const quotient = vec1.divide(scalar); // quotient = {x: 5, y: 4, z: 3}

See Also