Add setter for crword agent position and velocity

This commit is contained in:
Wojtek Figat
2024-03-30 22:29:43 +01:00
parent 294b4c4006
commit c5e1abb08c
2 changed files with 32 additions and 0 deletions

View File

@@ -104,6 +104,15 @@ Vector3 NavCrowd::GetAgentPosition(int32 id) const
return result;
}
void NavCrowd::SetAgentPosition(int32 id, const Vector3& position)
{
dtCrowdAgent* agent = _crowd->getEditableAgent(id);
if (agent)
{
*(Float3*)agent->npos = Float3(position);
}
}
Vector3 NavCrowd::GetAgentVelocity(int32 id) const
{
Vector3 result = Vector3::Zero;
@@ -115,6 +124,15 @@ Vector3 NavCrowd::GetAgentVelocity(int32 id) const
return result;
}
void NavCrowd::SetAgentVelocity(int32 id, const Vector3& velocity)
{
dtCrowdAgent* agent = _crowd->getEditableAgent(id);
if (agent)
{
*(Float3*)agent->nvel = Float3(velocity);
}
}
void NavCrowd::SetAgentProperties(int32 id, const NavAgentProperties& properties)
{
dtCrowdAgentParams agentParams;