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

Method createAgent

tests/cpp-tests/Source/NavMeshTest/NavMeshTest.cpp:170–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168}
169
170void NavMeshBaseTestDemo::createAgent(const Vec3& pos)
171{
172 std::string filePath = "MeshRendererTest/girl.c3b";
173 NavMeshAgentParam param;
174 param.radius = 2.0f;
175 param.height = 8.0f;
176 param.maxSpeed = 8.0f;
177 auto agent = NavMeshAgent::create(param);
178 auto agentNode = MeshRenderer::create(filePath);
179 agent->setOrientationRefAxes(Vec3(-1.0f, 0.0f, 1.0f));
180 AgentUserData* data = new AgentUserData{0.0f};
181 agent->setUserData(data);
182 agentNode->setScale(0.05f);
183 agentNode->addComponent(agent);
184
185 auto node = Node::create();
186 node->addChild(agentNode);
187 node->setPosition3D(pos);
188 node->setCameraMask((unsigned short)CameraFlag::USER1);
189 this->addChild(node);
190
191 auto animation = Animation3D::create(filePath);
192 auto animate = Animate3D::create(animation);
193 if (animate)
194 {
195 agentNode->runAction(RepeatForever::create(animate));
196 animate->setSpeed(0);
197 }
198
199 _agents.emplace_back(std::make_pair(agent, animate));
200}
201
202void NavMeshBaseTestDemo::createObstacle(const Vec3& pos)
203{

Callers

nothing calls this directly

Calls 12

createFunction · 0.85
setOrientationRefAxesMethod · 0.80
addComponentMethod · 0.80
Vec3Function · 0.50
setUserDataMethod · 0.45
setScaleMethod · 0.45
addChildMethod · 0.45
setPosition3DMethod · 0.45
setCameraMaskMethod · 0.45
runActionMethod · 0.45
setSpeedMethod · 0.45
emplace_backMethod · 0.45

Tested by

no test coverage detected