MCPcopy Create free account
hub / github.com/axmolengine/axmol / syncToAgent

Method syncToAgent

core/navmesh/NavMeshAgent.cpp:387–411  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

385}
386
387void NavMeshAgent::syncToAgent()
388{
389 if (_crowd)
390 {
391 auto agent = _crowd->getEditableAgent(_agentID);
392 Mat4 mat = _owner->getNodeToWorldTransform();
393 agent->npos[0] = mat.m[12];
394 agent->npos[1] = mat.m[13];
395 agent->npos[2] = mat.m[14];
396 // if (_needAutoOrientation){
397 // Vec3 vel = mat * _rotRefAxes;
398 // agent->vel[0] = vel.x;
399 // agent->vel[1] = vel.y;
400 // agent->vel[2] = vel.z;
401 // }
402 if (_needUpdateAgent)
403 {
404 dtCrowdAgentParams ap;
405 convertTodtAgentParam(_param, ap);
406 agent->params = ap;
407 agent->state = _state;
408 _needUpdateAgent = false;
409 }
410 }
411}
412
413Vec3 NavMeshAgent::getVelocity() const
414{

Calls 2

getEditableAgentMethod · 0.80

Tested by

no test coverage detected