mirror of
https://github.com/bloeys/physx-go.git
synced 2025-12-29 07:58:20 +00:00
Add funcs to set/get rigid actor user data
This commit is contained in:
Binary file not shown.
Binary file not shown.
11
pgo/pgo.go
11
pgo/pgo.go
@ -544,7 +544,6 @@ type Quat struct {
|
||||
cQ C.struct_CPxQuat
|
||||
}
|
||||
|
||||
// CPxAPI CPxInline CSTRUCT CPxQuat NewCPxQuat(float angleRads, float x, float y, float z);
|
||||
func NewQuat(angleRads, x, y, z float32) *Quat {
|
||||
return &Quat{
|
||||
cQ: C.NewCPxQuat(C.float(angleRads), C.float(x), C.float(y), C.float(z)),
|
||||
@ -668,7 +667,15 @@ func (ra *RigidActor) SetSimFilterData(fd *FilterData) {
|
||||
C.CPxRigidActor_setSimFilterData(ra.cRa, fd.cFilterData)
|
||||
}
|
||||
|
||||
// CPxAPI void CPxRigidActor_setSimFilterData(CSTRUCT CPxRigidActor* cra, CSTRUCT CPxFilterData* cfd);
|
||||
// SetUserData sets the void* field on the rigid actor which can be used for any purpose.
|
||||
// For example, it can be used to store an id or pointer that ties this rigid actor to some other object
|
||||
func (ra *RigidActor) SetUserData(userData unsafe.Pointer) {
|
||||
C.CPxRigidActor_set_userData(ra.cRa, userData)
|
||||
}
|
||||
|
||||
func (ra *RigidActor) GetUserData() unsafe.Pointer {
|
||||
return C.CPxRigidActor_get_userData(ra.cRa)
|
||||
}
|
||||
|
||||
type RigidStatic struct {
|
||||
cRs C.struct_CPxRigidStatic
|
||||
|
||||
@ -4,7 +4,8 @@
|
||||
#include "CPxFilterData.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
struct CPxRigidActor
|
||||
@ -14,6 +15,8 @@ extern "C" {
|
||||
|
||||
// Sets the CPxFilterData on all the shapes of the actor.
|
||||
CPxAPI void CPxRigidActor_setSimFilterData(CSTRUCT CPxRigidActor cra, CSTRUCT CPxFilterData cfd);
|
||||
CPxAPI void CPxRigidActor_set_userData(CSTRUCT CPxRigidActor cra, void *userData);
|
||||
CPxAPI void *CPxRigidActor_get_userData(CSTRUCT CPxRigidActor cra);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user