| 2067 | } |
| 2068 | |
| 2069 | void PhysicsBackend::SetSceneOrigin(void* scene, const Vector3& oldOrigin, const Vector3& newOrigin) |
| 2070 | { |
| 2071 | auto scenePhysX = (ScenePhysX*)scene; |
| 2072 | const PxVec3 shift = C2P(newOrigin - oldOrigin); |
| 2073 | scenePhysX->Origin = newOrigin; |
| 2074 | scenePhysX->Scene->shiftOrigin(shift); |
| 2075 | scenePhysX->ControllerManager->shiftOrigin(shift); |
| 2076 | #if WITH_VEHICLE |
| 2077 | WheelVehiclesCache.Clear(); |
| 2078 | for (auto wheelVehicle : scenePhysX->WheelVehicles) |
| 2079 | { |
| 2080 | if (!wheelVehicle->IsActiveInHierarchy()) |
| 2081 | continue; |
| 2082 | auto drive = (PxVehicleWheels*)wheelVehicle->_vehicle; |
| 2083 | ASSERT(drive); |
| 2084 | WheelVehiclesCache.Add(drive); |
| 2085 | } |
| 2086 | PxVehicleShiftOrigin(shift, WheelVehiclesCache.Count(), WheelVehiclesCache.Get()); |
| 2087 | #endif |
| 2088 | #if WITH_CLOTH |
| 2089 | if (scenePhysX->ClothSolver) |
| 2090 | { |
| 2091 | const int32 clothsCount = scenePhysX->ClothSolver->getNumCloths(); |
| 2092 | nv::cloth::Cloth* const* cloths = scenePhysX->ClothSolver->getClothList(); |
| 2093 | for (int32 i = 0; i < clothsCount; i++) |
| 2094 | { |
| 2095 | cloths[i]->teleport(shift); |
| 2096 | } |
| 2097 | } |
| 2098 | #endif |
| 2099 | SceneOrigins[scenePhysX->Scene] = newOrigin; |
| 2100 | } |
| 2101 | |
| 2102 | void PhysicsBackend::AddSceneActor(void* scene, void* actor) |
| 2103 | { |