removing dependency of entities lib on physics lib physics lib now depends on entities lib
Showing the changes to interface/src/Application.cpp (1 of 39 files). Show all
Unified · Split
| @@ -2021,8 +2021,8 @@ void Application::init() { · 2020 unmodified lines | |||
| 2021 | connect(_myAvatar, &MyAvatar::transformChanged, this, &Application::updateMyAvatarTransform); | 2021 | connect(_myAvatar, &MyAvatar::transformChanged, this, &Application::updateMyAvatarTransform); |
| 2022 | 2022 | ||
| 2023 | #ifdef USE_BULLET_PHYSICS | 2023 | #ifdef USE_BULLET_PHYSICS |
| 2024 | _physicsEngine.initSafe(_entities.getTree()); | 2024 | // _physicsEngine.initSafe(_entities.getTree()); |
| 2025 | _entities.getTree()->setPhysicsEngine(&_physicsEngine); | 2025 | // _entities.getTree()->setSimulation(&_physicsEngine); |
| 2026 | #endif // USE_BULLET_PHYSICS | 2026 | #endif // USE_BULLET_PHYSICS |
| 2027 | } | 2027 | } |
| 2028 | 2028 | ||
| @@ -4159,15 +4159,14 @@ void Application::updateMyAvatarTransform() { · 2130 unmodified lines | |||
| 4159 | glm::vec3 avatarPosition = _myAvatar->getPosition(); | 4159 | glm::vec3 avatarPosition = _myAvatar->getPosition(); |
| 4160 | glm::vec3 physicsWorldOffset = _physicsEngine.getOriginOffset(); | 4160 | glm::vec3 physicsWorldOffset = _physicsEngine.getOriginOffset(); |
| 4161 | if (glm::distance(avatarPosition, physicsWorldOffset) > SIMULATION_OFFSET_QUANTIZATION) { | 4161 | if (glm::distance(avatarPosition, physicsWorldOffset) > SIMULATION_OFFSET_QUANTIZATION) { |
| 4162 | //_entityCollisionSystem.forgetAllPhysics(); | ||
| 4163 | glm::vec3 newOriginOffset = avatarPosition; | 4162 | glm::vec3 newOriginOffset = avatarPosition; |
| 4164 | int halfExtent = (int)HALF_SIMULATION_EXTENT; | 4163 | int halfExtent = (int)HALF_SIMULATION_EXTENT; |
| 4165 | for (int i = 0; i < 3; ++i) { | 4164 | for (int i = 0; i < 3; ++i) { |
| 4166 | newOriginOffset[i] = (float)(glm::max(halfExtent, | 4165 | newOriginOffset[i] = (float)(glm::max(halfExtent, |
| 4167 | ((int)(avatarPosition[i] / SIMULATION_OFFSET_QUANTIZATION)) * (int)SIMULATION_OFFSET_QUANTIZATION)); | 4166 | ((int)(avatarPosition[i] / SIMULATION_OFFSET_QUANTIZATION)) * (int)SIMULATION_OFFSET_QUANTIZATION)); |
| 4168 | } | 4167 | } |
| 4168 | // TODO: Andrew to replace this with method that actually moves existing object positions in PhysicsEngine | ||
| 4169 | _physicsEngine.setOriginOffset(newOriginOffset); | 4169 | _physicsEngine.setOriginOffset(newOriginOffset); |
| 4170 | //_entityCollisionSystem.rememberAllPhysics(); | ||
| 4171 | } | 4170 | } |
| 4172 | #endif // USE_BULLET_PHYSICS | 4171 | #endif // USE_BULLET_PHYSICS |
| 4173 | } | 4172 | } |