-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathColliderDebugData.h
More file actions
44 lines (33 loc) · 1.05 KB
/
Copy pathColliderDebugData.h
File metadata and controls
44 lines (33 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#pragma once
#include "Physx.h"
struct ColliderDebugData
{
PxTransform shapeWorldTransform;
static ColliderDebugData GetDebugData(uint32_t instanceID)
{
auto ptr = Physics->GetRigidBody(instanceID);
StaticRigidBody* staticBody = dynamic_cast<StaticRigidBody*>(ptr);
if (staticBody)
{
ColliderDebugData debugData;
auto pxStaticBody = staticBody->GetRigidStatic();
PxTransform actorWorldPose = pxStaticBody->getGlobalPose();
uint32_t shapeIndex = pxStaticBody->getNbShapes();
PxShape* shape[64]{};
uint32_t shapeCount = pxStaticBody->getShapes(shape, shapeIndex);
std::vector<PxShape*> shapes(shape, shape + shapeCount);
for (auto& shape : shapes)
{
auto& geometry = shape->getGeometry();
if (geometry.getType() == PxGeometryType::eBOX)
{
const PxBoxGeometry& boxGeometry =
static_cast<const PxBoxGeometry&>(geometry);
}
}
PxTransform shapeLocalPose = {};
return debugData;
}
throw std::runtime_error("ColliderDebugData::GetDebugData : Invalid instanceID or not a StaticRigidBody");
}
};