Skip to content

lengthdir_x

Vašek edited this page Jan 16, 2019 · 6 revisions

lengthdir_x

Returns the horizontal x-component of the vector

Syntax:

lengthdir_x(len, dir)
Argument Description
double len The length away of the point to return
double dir The direction of the point to return

Returns: double

Description:

This function returns the x-component of the given vector. Imagine a circle around your starting position and then imagine a point anywhere on that circle. This point is in a distance len from starting position and in a direction dir. This function will return the relative positon of an x coordinate from your starting position.

This function, when used with lengthdir_y, gets the position of that point on the circle to be used in code by the instance.

Example:

lengthdir_x(5,50); //return 3,213939

This function returns 3.213939, so the x coordinate of that point in a distance 5 and in the dircetion 50, is x + 3,213939.

Back to number_functions

Clone this wiki locally