mirror of
https://github.com/bloeys/physx-go.git
synced 2025-12-29 07:58:20 +00:00
Start raycast implementation
This commit is contained in:
@ -3,11 +3,39 @@
|
||||
|
||||
#include "CPxPvdSceneClient.h"
|
||||
#include "CPxActor.h"
|
||||
#include "CPxVec3.h"
|
||||
#include "CPxShape.h"
|
||||
#include "CPxRigidActor.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct CPxRaycastHit
|
||||
{
|
||||
//CPxHitFlags flags; //!< Hit flags specifying which members contain valid values.
|
||||
struct CPxVec3 position; //!< World-space hit position (flag: #PxHitFlag::ePOSITION)
|
||||
struct CPxVec3 normal; //!< World-space hit normal (flag: #PxHitFlag::eNORMAL)
|
||||
|
||||
/**
|
||||
\brief Distance to hit.
|
||||
\note If the eMTD flag is used, distance will be a negative value if shapes are overlapping indicating the penetration depth.
|
||||
\note Otherwise, this value will be >= 0 */
|
||||
CPxF32 distance;
|
||||
CPxReal u, v;
|
||||
CPxU32 faceIndex;
|
||||
struct CPxShape shape;
|
||||
struct CPxRigidActor actor;
|
||||
};
|
||||
|
||||
struct CPxRaycastBuffer
|
||||
{
|
||||
struct CPxRaycastHit block;
|
||||
struct CPxRaycastHit* touches;
|
||||
CPxU32 nbTouches;
|
||||
bool hasBlock;
|
||||
};
|
||||
|
||||
struct CPxScene
|
||||
{
|
||||
void* obj;
|
||||
@ -22,6 +50,7 @@ extern "C" {
|
||||
CPxAPI bool CPxScene_fetchCollision(CSTRUCT CPxScene*, bool block);
|
||||
CPxAPI void CPxScene_advance(CSTRUCT CPxScene*);
|
||||
CPxAPI bool CPxScene_fetchResults(CSTRUCT CPxScene*, bool block, CPxU32* errorState);
|
||||
CPxAPI bool CPxScene_raycast(CSTRUCT CPxScene* cs, CSTRUCT CPxVec3* origin, CSTRUCT CPxVec3* unitDir, CPxReal distance, CSTRUCT CPxRaycastBuffer** hitRet);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a scratch buffer thats a multiple of 16K to be used by the scene when running CPxScene_simulate.
|
||||
|
||||
Reference in New Issue
Block a user