Vector/Vector2: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (Restructure)
m (Add Vector2.create)
Line 5: Line 5:
==Methods==
==Methods==
===create===
===create===
This is default constructor for the Vector2 class and returns a Vector2 object.
====Syntax====
<syntaxhighlight lang="lua">vector2 Vector2 ( float x = 0, float y = 0 )</syntaxhighlight>
* '''x''', and '''y''' coordinates for the vector. If not specified, they default to 0.
* Instead of these two coordinates, a single Vector2 object may be inserted to clone it.
====Example====
This example ...
<section name="Shared" class="both" show="true">
<syntaxhighlight lang="lua">-- todo</syntaxhighlight>
===normalize===
===normalize===
===dot===
===dot===

Revision as of 21:41, 2 February 2015

The Vector2 class is a class introduced in 1.4

Methods

create

This is default constructor for the Vector2 class and returns a Vector2 object.

Syntax

vector2 Vector2 ( float x = 0, float y = 0 )
  • x, and y coordinates for the vector. If not specified, they default to 0.
  • Instead of these two coordinates, a single Vector2 object may be inserted to clone it.

Example

This example ... <section name="Shared" class="both" show="true">

-- todo

normalize

dot

getX and setX

getY and setY

getNormalized

getSquaredLength

getLength