#How does Vector2Angle() work?

9 messages · Page 1 of 1 (latest)

narrow basin
#

this gives prints out 90 shouldn't it be 45? I don't understand this function vec := rl.Vector2Angle({0,0},{1,1}) vec *= rl.RAD2DEG fps_text := fmt.ctprintf("angle: %f",vec) rl.DrawText(fps_text,10,10,50,rl.BLUE)

primal mango
#

strange to display 90, because it's 0

narrow basin
#

is this diagram wrong

primal mango
#
int x1 = 0;
int y1 = 0;
int x2 = 1;
int y2 = 1;

float deltaX = x2 - x1;
float deltaY = y2 - y1;

float angleInDegrees = atan2(deltaY, deltaX) * RAD2DEG;
#

it's the real method to know angle from two positions

#

Vector2Angle is for two VECTOR and return 0 if it's the same direction

narrow basin
#

Yeah I used a similar method to get the degrees. I just want understand what Vector2Angle does?

#

@primal mango ty for the help

narrow basin
#

I feel a bit stupid, but now i get it