diff --git a/CHANGELOG.md b/CHANGELOG.md index a1e3524..6e244f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Removed - Removed RcVecUtils.Dot() +- Removed RcVecUtils.Scale() ### Special Thanks - [@Doprez](https://github.com/Doprez) diff --git a/src/DotRecast.Core/Numerics/RcVecUtils.cs b/src/DotRecast.Core/Numerics/RcVecUtils.cs index 0dab29c..a083b2c 100644 --- a/src/DotRecast.Core/Numerics/RcVecUtils.cs +++ b/src/DotRecast.Core/Numerics/RcVecUtils.cs @@ -42,12 +42,6 @@ namespace DotRecast.Core.Numerics } } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static RcVec3f Scale(this RcVec3f v, float scale) - { - return v * scale; - } - /// Derives the dot product of two vectors on the xz-plane. (@p u . @p v) /// @param[in] u A vector [(x, y, z)] /// @param[in] v A vector [(x, y, z)] diff --git a/src/DotRecast.Detour.Crowd/DtCrowd.cs b/src/DotRecast.Detour.Crowd/DtCrowd.cs index 55b1c63..94395ac 100644 --- a/src/DotRecast.Detour.Crowd/DtCrowd.cs +++ b/src/DotRecast.Detour.Crowd/DtCrowd.cs @@ -1063,7 +1063,7 @@ namespace DotRecast.Detour.Crowd float speedScale = ag.GetDistanceToGoal(slowDownRadius) / slowDownRadius; ag.desiredSpeed = ag.option.maxSpeed; - dvel = dvel.Scale(ag.desiredSpeed * speedScale); + dvel = dvel * (ag.desiredSpeed * speedScale); } // Separation @@ -1110,7 +1110,7 @@ namespace DotRecast.Detour.Crowd float desiredSqr = RcMath.Sqr(ag.desiredSpeed); if (speedSqr > desiredSqr) { - dvel = dvel.Scale(desiredSqr / speedSqr); + dvel = dvel * (desiredSqr / speedSqr); } } } @@ -1268,7 +1268,7 @@ namespace DotRecast.Detour.Crowd if (w > 0.0001f) { float iw = 1.0f / w; - ag.disp = ag.disp.Scale(iw); + ag.disp = ag.disp * iw; } } diff --git a/src/DotRecast.Detour.Crowd/DtCrowdAgent.cs b/src/DotRecast.Detour.Crowd/DtCrowdAgent.cs index 7831af3..c186fed 100644 --- a/src/DotRecast.Detour.Crowd/DtCrowdAgent.cs +++ b/src/DotRecast.Detour.Crowd/DtCrowdAgent.cs @@ -62,10 +62,10 @@ namespace DotRecast.Detour.Crowd /// The local path corridor corners for the agent. public DtStraightPath[] corners = new DtStraightPath[DtCrowdConst.DT_CROWDAGENT_MAX_CORNERS]; - + /// The number of corners. public int ncorners; - + public DtMoveRequestState targetState; // < State of the movement request. public long targetRef; // < Target polyref of the movement request. public RcVec3f targetPos = new RcVec3f(); // < Target position of the movement request (or velocity in case of DT_CROWDAGENT_TARGET_VELOCITY). @@ -91,7 +91,7 @@ namespace DotRecast.Detour.Crowd RcVec3f dv = RcVec3f.Subtract(nvel, vel); float ds = dv.Length(); if (ds > maxDelta) - dv = dv.Scale(maxDelta / ds); + dv = dv * (maxDelta / ds); vel = RcVec3f.Add(vel, dv); // Integrate @@ -150,7 +150,7 @@ namespace DotRecast.Detour.Crowd float len0 = dir0.Length(); float len1 = dir1.Length(); if (len1 > 0.001f) - dir1 = dir1.Scale(1.0f / len1); + dir1 = dir1 * (1.0f / len1); dir.X = dir0.X - dir1.X * len0 * 0.5f; dir.Y = 0; diff --git a/src/DotRecast.Detour.Crowd/DtObstacleAvoidanceQuery.cs b/src/DotRecast.Detour.Crowd/DtObstacleAvoidanceQuery.cs index eec4693..2aabd8d 100644 --- a/src/DotRecast.Detour.Crowd/DtObstacleAvoidanceQuery.cs +++ b/src/DotRecast.Detour.Crowd/DtObstacleAvoidanceQuery.cs @@ -236,7 +236,7 @@ namespace DotRecast.Detour.Crowd DtObstacleCircle cir = m_circles[i]; // RVO - RcVec3f vab = vcand.Scale(2); + RcVec3f vab = vcand * 2; vab = RcVec3f.Subtract(vab, vel); vab = RcVec3f.Subtract(vab, cir.vel); diff --git a/src/DotRecast.Recast.Toolset/Tools/RcCrowdTool.cs b/src/DotRecast.Recast.Toolset/Tools/RcCrowdTool.cs index 4bfbd5f..c78e406 100644 --- a/src/DotRecast.Recast.Toolset/Tools/RcCrowdTool.cs +++ b/src/DotRecast.Recast.Toolset/Tools/RcCrowdTool.cs @@ -297,7 +297,7 @@ namespace DotRecast.Recast.Toolset.Tools RcVec3f vel = RcVec3f.Subtract(tgt, pos); vel.Y = 0.0f; vel = RcVec3f.Normalize(vel); - return vel.Scale(speed); + return vel * speed; } public long GetCrowdUpdateTime() diff --git a/test/DotRecast.Detour.Crowd.Test/AbstractCrowdTest.cs b/test/DotRecast.Detour.Crowd.Test/AbstractCrowdTest.cs index b2f186d..fbd19f1 100644 --- a/test/DotRecast.Detour.Crowd.Test/AbstractCrowdTest.cs +++ b/test/DotRecast.Detour.Crowd.Test/AbstractCrowdTest.cs @@ -153,7 +153,7 @@ public class AbstractCrowdTest RcVec3f vel = RcVec3f.Subtract(tgt, pos); vel.Y = 0.0f; vel = RcVec3f.Normalize(vel); - vel = vel.Scale(speed); + vel = vel * speed; return vel; }