Add setter for crword agent position and velocity
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user