| 169 | } |
| 170 | |
| 171 | void 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 | |
| 188 | Physics3DTestDemo::Physics3DTestDemo() {} |
| 189 |
nothing calls this directly
no test coverage detected