| 281 | } |
| 282 | |
| 283 | void NavMeshBasicTestDemo::touchesEnded(const std::vector<ax::Touch*>& touches, ax::Event* event) |
| 284 | { |
| 285 | if (!_needMoveAgents) |
| 286 | return; |
| 287 | if (!touches.empty()) |
| 288 | { |
| 289 | auto touch = touches[0]; |
| 290 | auto location = touch->getLocationInView(); |
| 291 | Vec3 nearP(location.x, location.y, 0.0f), farP(location.x, location.y, 1.0f); |
| 292 | |
| 293 | auto size = Director::getInstance()->getWinSize(); |
| 294 | _camera->unproject(size, &nearP, &nearP); |
| 295 | _camera->unproject(size, &farP, &farP); |
| 296 | |
| 297 | Physics3DWorld::HitResult result; |
| 298 | getPhysics3DWorld()->rayCast(nearP, farP, &result); |
| 299 | moveAgents(result.hitPosition); |
| 300 | } |
| 301 | } |
| 302 | |
| 303 | bool NavMeshBasicTestDemo::init() |
| 304 | { |
nothing calls this directly
no test coverage detected