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

Method touchesEnded

tests/cpp-tests/Source/NavMeshTest/NavMeshTest.cpp:283–301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

281}
282
283void 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
303bool NavMeshBasicTestDemo::init()
304{

Callers

nothing calls this directly

Calls 6

getInstanceFunction · 0.85
getPhysics3DWorldFunction · 0.85
emptyMethod · 0.45
getLocationInViewMethod · 0.45
unprojectMethod · 0.45
rayCastMethod · 0.45

Tested by

no test coverage detected