瀏覽代碼

Bind Body::GetWorldSpaceSurfaceNormal

Lucien Greathouse 5 月之前
父節點
當前提交
45b0bdf232
共有 2 個文件被更改,包括 10 次插入4 次删除
  1. 2 1
      JoltC/Functions.h
  2. 8 3
      JoltCImpl/JoltC.cpp

+ 2 - 1
JoltC/Functions.h

@@ -923,7 +923,8 @@ JPC_API JPC_RMat44 JPC_Body_GetInverseCenterOfMassTransform(const JPC_Body* self
 JPC_API uint64_t JPC_Body_GetUserData(const JPC_Body* self);
 JPC_API uint64_t JPC_Body_GetUserData(const JPC_Body* self);
 JPC_API void JPC_Body_SetUserData(JPC_Body* self, uint64_t inUserData);
 JPC_API void JPC_Body_SetUserData(JPC_Body* self, uint64_t inUserData);
 
 
-// JPC_API JPC_Vec3 JPC_Body_GetWorldSpaceSurfaceNormal(const JPC_Body* self, const SubShapeID &inSubShapeID, JPC_RVec3 inPosition);
+JPC_API JPC_Vec3 JPC_Body_GetWorldSpaceSurfaceNormal(const JPC_Body* self, JPC_SubShapeID inSubShapeID, JPC_RVec3 inPosition);
+
 // JPC_API TransformedShape JPC_Body_GetTransformedShape(const JPC_Body* self);
 // JPC_API TransformedShape JPC_Body_GetTransformedShape(const JPC_Body* self);
 // JPC_API BodyCreationSettings JPC_Body_GetBodyCreationSettings(const JPC_Body* self);
 // JPC_API BodyCreationSettings JPC_Body_GetBodyCreationSettings(const JPC_Body* self);
 // JPC_API SoftBodyCreationSettings JPC_Body_GetSoftBodyCreationSettings(const JPC_Body* self);
 // JPC_API SoftBodyCreationSettings JPC_Body_GetSoftBodyCreationSettings(const JPC_Body* self);

+ 8 - 3
JoltCImpl/JoltC.cpp

@@ -218,7 +218,7 @@ static JPH::RShapeCast to_jph(JPC_RShapeCast in) {
 		to_jph(in.Direction));
 		to_jph(in.Direction));
 }
 }
 
 
-static JPH::SubShapeID to_jph_subshapeid(JPC_SubShapeID in) {
+static JPH::SubShapeID JPC_SubShapeID_to_jph(JPC_SubShapeID in) {
 	JPH::SubShapeID out;
 	JPH::SubShapeID out;
 	out.SetValue(in);
 	out.SetValue(in);
 	return out;
 	return out;
@@ -939,7 +939,7 @@ JPC_API uint32_t JPC_CompoundShape_GetSubShapeIndexFromID(
 	JPC_SubShapeID* outRemainder)
 	JPC_SubShapeID* outRemainder)
 {
 {
 	JPH::SubShapeID jphRemainder;
 	JPH::SubShapeID jphRemainder;
-	uint32_t res = to_jph(self)->GetSubShapeIndexFromID(to_jph_subshapeid(inSubShapeID), jphRemainder);
+	uint32_t res = to_jph(self)->GetSubShapeIndexFromID(JPC_SubShapeID_to_jph(inSubShapeID), jphRemainder);
 	*outRemainder = to_jpc(jphRemainder);
 	*outRemainder = to_jpc(jphRemainder);
 	return res;
 	return res;
 }
 }
@@ -1581,7 +1581,12 @@ JPC_API void JPC_Body_SetUserData(JPC_Body* self, uint64_t inUserData) {
 	to_jph(self)->SetUserData(inUserData);
 	to_jph(self)->SetUserData(inUserData);
 }
 }
 
 
-// JPC_API JPC_Vec3 JPC_Body_GetWorldSpaceSurfaceNormal(const JPC_Body* self, const SubShapeID &inSubShapeID, JPC_RVec3 inPosition);
+JPC_API JPC_Vec3 JPC_Body_GetWorldSpaceSurfaceNormal(const JPC_Body* self, JPC_SubShapeID inSubShapeID, JPC_RVec3 inPosition) {
+	JPH::SubShapeID jph_id = JPC_SubShapeID_to_jph(inSubShapeID);
+
+	return to_jpc(to_jph(self)->GetWorldSpaceSurfaceNormal(jph_id, to_jph(inPosition)));
+}
+
 // JPC_API TransformedShape JPC_Body_GetTransformedShape(const JPC_Body* self);
 // JPC_API TransformedShape JPC_Body_GetTransformedShape(const JPC_Body* self);
 // JPC_API BodyCreationSettings JPC_Body_GetBodyCreationSettings(const JPC_Body* self);
 // JPC_API BodyCreationSettings JPC_Body_GetBodyCreationSettings(const JPC_Body* self);
 // JPC_API SoftBodyCreationSettings JPC_Body_GetSoftBodyCreationSettings(const JPC_Body* self);
 // JPC_API SoftBodyCreationSettings JPC_Body_GetSoftBodyCreationSettings(const JPC_Body* self);