ACSUtils Wiki

An ACS library for ZDoom-based ports

User Tools

Site Tools


functions:vectortoangles

Differences

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

Link to this comparison view

Next revision
Previous revision
Last revisionBoth sides next revision
functions:vectortoangles [2017/03/17 18:09] – created korshunfunctions:vectortoangles [2019/04/20 23:55] – removed korshun
Line 1: Line 1:
-====== VectorToAngles ====== 
-{{tag>math vectors}} 
-''angle, angle VectorToAngles(fixed x, fixed y, fixed z)'' 
  
-[[:types|angle - a fixed-point]] [[zdoom>Definitions#Fixed_point_angles|ZDoom angle]] [[:types|(not degrees or radians)]] 
- 
-[[:Multiple_return_values|This function returns multiple values.]] 
- 
-===== Description ===== 
-Converts a 3D vector to a pair of angles (yaw and pitch). 
- 
-===== Examples ===== 
-Make the player look along the vector: 
-<code> 
-VectorToAngles(1.0, 2.0, 3.0); 
-int angle = r1; 
-int pitch = r2; 
-SetActorAngle(tid, angle); 
-SetActorPitch(tid, -pitch); // Note that actor pitch is inverted in ZDoom. 
-</code> 
- 
-<note tip>Use ''[[functions:zdoom#lookatpoint|LookAtPoint]]'' instead of the example code above.</note> 
functions/vectortoangles.txt · Last modified: 2019/04/20 23:56 by korshun