Rigiddynamic CMass+Shape local poses

This commit is contained in:
bloeys
2022-01-28 09:27:50 +04:00
parent eb4519cc53
commit 940a0b2db6
6 changed files with 39 additions and 1 deletions

Binary file not shown.

View File

@ -157,6 +157,16 @@ type Shape struct {
cShape C.struct_CPxShape
}
func (s *Shape) GetLocalPose() *Transform {
return &Transform{
cT: C.CPxShape_getLocalPose(&s.cShape),
}
}
func (s *Shape) SetLocalPose(tr *Transform) {
C.CPxShape_setLocalPose(&s.cShape, &tr.cT)
}
func CreateExclusiveShape(rigidActor RigidActor, geom *Geometry, mat *Material, shapeFlags ShapeFlags) Shape {
return Shape{
cShape: C.createExclusiveShape(rigidActor.cRa, geom.cG, mat.cM, uint32(shapeFlags)),

View File

@ -47,6 +47,9 @@ extern "C" {
CPxAPI CSTRUCT CPxTransform CPxRigidDynamic_getGlobalPose(CSTRUCT CPxRigidDynamic* crd);
CPxAPI void CPxRigidDynamic_setGlobalPose(CSTRUCT CPxRigidDynamic* crd, CSTRUCT CPxTransform* tr, bool autoAwake);
CPxAPI CSTRUCT CPxTransform CPxRigidDynamic_getCMassLocalPose(CSTRUCT CPxRigidDynamic* crd);
CPxAPI void CPxRigidDynamic_setCMassLocalPose(CSTRUCT CPxRigidDynamic* crd, CSTRUCT CPxTransform* tr);
#ifdef __cplusplus
}
#endif

View File

@ -1,6 +1,8 @@
#ifndef CPxShape_H
#define CPxShape_H
#include "CPxTransform.h"
#ifdef __cplusplus
extern "C" {
#endif
@ -10,6 +12,9 @@ extern "C" {
void* obj;
};
CPxAPI void CPxShape_setLocalPose(CSTRUCT CPxShape* cs, CSTRUCT CPxTransform* tr);
CPxAPI CSTRUCT CPxTransform CPxShape_getLocalPose(CSTRUCT CPxShape* cs);
#ifdef __cplusplus
}
#endif

View File

@ -95,6 +95,16 @@ func (rd *RigidDynamic) SetGlobalPose(tr *Transform, autoAwake bool) {
C.CPxRigidDynamic_setGlobalPose(rd.cRd, &tr.cT, C._Bool(autoAwake))
}
func (rd *RigidDynamic) GetCMassLocalPose() *Transform {
return &Transform{
cT: C.CPxRigidDynamic_getCMassLocalPose(rd.cRd),
}
}
func (rd *RigidDynamic) SetCMassLocalPose(tr *Transform) {
C.CPxRigidDynamic_setCMassLocalPose(rd.cRd, &tr.cT)
}
func (rd *RigidDynamic) ToActor() Actor {
return Actor{
cA: C.CPxRigidDynamic_toCPxActor(rd.cRd),