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

Method onTouchesEnded

tests/cpp-tests/Source/Physics3DTest/Physics3DTest.cpp:171–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

169}
170
171void Physics3DTestDemo::onTouchesEnded(const std::vector<Touch*>& touches, ax::Event* event)
172{
173 if (!_needShootBox)
174 return;
175 if (!touches.empty())
176 {
177 auto location = touches[0]->getLocationInView();
178
179 Vec3 nearP(location.x, location.y, -1.0f), farP(location.x, location.y, 1.0f);
180 nearP = _camera->unproject(nearP);
181 farP = _camera->unproject(farP);
182 Vec3 dir(farP - nearP);
183 shootBox(_camera->getPosition3D() + dir * 10.0f);
184 event->stopPropagation();
185 }
186}
187
188Physics3DTestDemo::Physics3DTestDemo() {}
189

Callers

nothing calls this directly

Calls 6

stopPropagationMethod · 0.80
emptyMethod · 0.45
getLocationInViewMethod · 0.45
unprojectMethod · 0.45
getPosition3DMethod · 0.45

Tested by

no test coverage detected