MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / SetSceneOrigin

Method SetSceneOrigin

Source/Engine/Physics/PhysX/PhysicsBackendPhysX.cpp:2069–2100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2067}
2068
2069void 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
2102void PhysicsBackend::AddSceneActor(void* scene, void* actor)
2103{

Callers

nothing calls this directly

Calls 6

C2PFunction · 0.85
PxVehicleShiftOriginFunction · 0.85
ClearMethod · 0.45
AddMethod · 0.45
CountMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected