Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // physx sdk 3.2.0.1 needed
- physx::PxScene* GetScene ()
- {
- typedef void* (__cdecl* GetPhysicsFn)();
- GetPhysicsFn GetPhysics = (GetPhysicsFn) GetProcAddress ( GetModuleHandleA ( "PhysX3_x64" ), "PxGetPhysics" );
- void* pPhysics = GetPhysics ();
- physx::PxScene* pScene = nullptr;
- typedef void (__thiscall* getActiveSceneFn)( void*, physx::PxScene**, int, int );
- GetMethod<getActiveSceneFn> ( pPhysics, INDEX_GETSCENE )( pPhysics, &pScene, 1, 0 );
- return pScene;
- }
- bool IsPointVisible ( const Vecotr3& vStart, const Vector3& vEnd )
- {
- static physx::PxScene* pScene = GetScene ();
- if ( !pScene )
- return false;
- physx::PxVec3 pStart = *(physx::PxVec3*)&vStart;
- physx::PxVec3 pEnd = *(physx::PxVec3*)&vEnd;
- physx::PxVec3 pDelta = pEnd - pStart;
- physx::PxReal Length = pDelta.magnitude ();
- pDelta.normalize ();
- physx::PxSceneQueryHit Hit;
- if ( pScene->raycastAny ( pStart, pDelta, Length, Hit, physx::PxSceneQueryFilterData ( physx::PxSceneQueryFilterFlag::eSTATIC ) ) )
- return false;
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement