Removed RcVecUtils.Scale()

This commit is contained in:
ikpil 2024-06-07 21:31:11 +09:00
parent 0f20db44bb
commit b18845a749
7 changed files with 11 additions and 16 deletions

View File

@ -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)

View File

@ -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)]

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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);

View File

@ -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()

View File

@ -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;
}