Tile - YVector3 - Move Towards – Ylands

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
No edit summary
Line 10: Line 10:


==== a ====
==== a ====
Vector A


==== b ====
==== b ====
Vector B


==== maxDistance ====
==== maxDistance ====
Maximum distance


=== Returns ===
=== Returns ===


'''YVector3'''
'''YVector3'''
=== Availability ===
[[Ylands:Tile Availability - Client|Client]], [[Ylands:Tile Availability - Server|Server]], [[Ylands:Tile Availability - Custom Controller|Custom Controller]]


=== Description ===
=== Description ===


'''Moves''' a point '''A''' in a straight line '''towards''' a target point '''B''', '''limited''' by maximum distance (meters). If the '''target''' is '''closer''' than '''maximum distance''' then the returned value will be '''equal''' to '''target'''. '''Negative''' values of maximum distance can be used to '''push''' the point '''away''' from the target.
'''Moves''' point '''A''' in a straight line '''towards''' target point '''B''', '''limited''' by maximum distance (meters).
 
=== Notes ===
 
* If the '''target''' is '''closer''' than '''maximum distance''' then the returned value will be '''equal''' to '''target'''.
* '''Negative''' values of maximum distance can be used to '''push''' the point '''away''' from the target.





Revision as of 11:17, 12 November 2021

Move Towards(A, B, Max Distance)

YlandsTile-152.png

static moveTowards(a: YVector3, b: YVector3, maxDistance: number): YVector3;

Parameters

a

Vector A

b

Vector B

maxDistance

Maximum distance

Returns

YVector3

Availability

Client, Server, Custom Controller

Description

Moves point A in a straight line towards target point B, limited by maximum distance (meters).

Notes

  • If the target is closer than maximum distance then the returned value will be equal to target.
  • Negative values of maximum distance can be used to push the point away from the target.