| 72 | |
| 73 | //scene query methods |
| 74 | struct RaycastHit { |
| 75 | RaycastHit() {} |
| 76 | RaycastHit(const physx::PxRaycastBuffer& hit) { |
| 77 | hasBlocking = hit.hasBlock; |
| 78 | hitPosition = vector3(hit.block.position.x, hit.block.position.y, hit.block.position.z); |
| 79 | hitNormal = vector3(hit.block.normal.x, hit.block.normal.y, hit.block.normal.z); |
| 80 | hitDistance = hit.block.distance; |
| 81 | hitObject = ((PhysicsBodyComponent*)hit.block.actor->userData)->getOwner(); |
| 82 | } |
| 83 | bool hasBlocking; |
| 84 | vector3 hitPosition; |
| 85 | vector3 hitNormal; |
| 86 | decimalType hitDistance; |
| 87 | Ref<Entity> hitObject; |
| 88 | }; |
| 89 | |
| 90 | /** |
| 91 | Perform a raycast in the scene. |