From fe15e836bd87963d10bd301a3a24652763059e0d Mon Sep 17 00:00:00 2001 From: jussi Date: Thu, 6 Apr 2023 19:19:44 +0300 Subject: Switched to Raylib vertion 4.5. Removed some functions and added others. Main changes to camera3D. --- src/rmath.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/rmath.c') diff --git a/src/rmath.c b/src/rmath.c index 26054e4..0b4623d 100644 --- a/src/rmath.c +++ b/src/rmath.c @@ -411,6 +411,31 @@ int lmathVector2Angle( lua_State *L ) { return 1; } +/* +> result = RL.Vector2LineAngle( Vector2 start, Vector2 end ) + +Calculate angle defined by a two vectors line. +NOTE: Parameters need to be normalized. +Current implementation should be aligned with glm::angle. + +- Failure return false +- Success return float +*/ +int lmathVector2LineAngle( lua_State *L ) { + if ( !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) { + TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.Vector2LineAngle( Vector2 start, Vector2 end )" ); + lua_pushboolean( L, false ); + return 1; + } + Vector2 end = uluaGetVector2( L ); + lua_pop( L, 1 ); + Vector2 start = uluaGetVector2( L ); + + lua_pushnumber( L, Vector2LineAngle( start, end ) ); + + return 1; +} + /* > result = RL.Vector2Scale( Vector2 v, float scale ) -- cgit v1.2.3