mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Recast: fix stack var typo and update documentation around off-mesh ref yaw angles
This commit is contained in:
parent
0d1b12819e
commit
5b1bdbef68
@ -367,14 +367,14 @@ struct dtOffMeshConnection
|
||||
/// Calculates the yaw angle in an off-mesh connection.
|
||||
/// @param spos[in] The start position of the off mesh connection.
|
||||
/// @param epos[in] The end position of the off mesh connection.
|
||||
/// returns the yaw angle on the XY plane.
|
||||
/// returns the yaw angle on the XY plane in radians.
|
||||
extern float dtCalcOffMeshRefYaw(const float* spos, const float* epos);
|
||||
/// Calculates the ref position in an off-mesh connection.
|
||||
/// @param spos[in] The start position of the off mesh connection.
|
||||
/// @param yaw[in] The yaw angle of the off-mesh connection.
|
||||
/// @param yawRad[in] The yaw angle of the off-mesh connection in radians.
|
||||
/// @param offset[in] The desired offset from the start position.
|
||||
/// @param res[in] The output ref position.
|
||||
extern void dtCalcOffMeshRefPos(const float* spos, float yaw, float offset, float* res);
|
||||
extern void dtCalcOffMeshRefPos(const float* spos, float yawRad, float offset, float* res);
|
||||
|
||||
/// Provides high level information related to a dtMeshTile object.
|
||||
/// @ingroup detour
|
||||
|
@ -1890,16 +1890,16 @@ float dtCalcOffMeshRefYaw(const float* spos, const float* epos)
|
||||
const float dx = epos[0]-spos[0];
|
||||
const float dy = epos[1]-spos[1];
|
||||
|
||||
const float yaw = rdMathAtan2f(dy, dx) * (180.0f/RD_PI);
|
||||
return yaw;
|
||||
const float yawDeg = rdMathAtan2f(dy, dx);
|
||||
return yawDeg * (180.0f/RD_PI);
|
||||
}
|
||||
|
||||
void dtCalcOffMeshRefPos(const float* spos, float yaw, float offset, float* res)
|
||||
void dtCalcOffMeshRefPos(const float* spos, float yawRad, float offset, float* res)
|
||||
{
|
||||
const float yawRad = yaw * (RD_PI/180.0f);
|
||||
const float yawDeg = yawRad * (RD_PI/180.0f);
|
||||
|
||||
const float dx = offset*rdMathCosf(yawRad);
|
||||
const float dy = offset*rdMathSinf(yawRad);
|
||||
const float dx = offset*rdMathCosf(yawDeg);
|
||||
const float dy = offset*rdMathSinf(yawDeg);
|
||||
|
||||
res[0] = spos[0]+dx;
|
||||
res[1] = spos[1]+dy;
|
||||
|
Loading…
x
Reference in New Issue
Block a user