ACSUtils Wiki

An ACS library for ZDoom-based ports

User Tools

Site Tools


functions:vectorlength3d

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

functions:vectorlength3d [2019/07/06 17:04] (current)
monsterovich created
Line 1: Line 1:
 +====== VectorLength3D ======
 +{{tag>​math vectors}}
 +''​fixed VectorLength3D(fixed x, fixed y, fixed z)''​
 +
 +===== Description =====
 +Returns the length of the given 3D vector.
 +
 +===== Example =====
 +Show 3D distance between actors:
 +<​code>​
 +int x = GetActorX(tid2) - GetActorX(tid1);​
 +int y = GetActorY(tid2) - GetActorY(tid1);​
 +int z = GetActorZ(tid2) - GetActorZ(tid1);​
 +int distance = length3d(x, y, z),
 +print(s:"​The two actors are ", f:distance, s:" mapunits apart in 3D space"​);​
 +</​code>​
 +
 +<note tip>Use [[ActorDistance]] instead of the example code above.</​note>​
 +
  
functions/vectorlength3d.txt ยท Last modified: 2019/07/06 17:04 by monsterovich