| 168 | } |
| 169 | |
| 170 | void 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 | |
| 202 | void NavMeshBaseTestDemo::createObstacle(const Vec3& pos) |
| 203 | { |
nothing calls this directly
no test coverage detected