mirror of https://github.com/bjornbytes/lovr.git
Fix setMass allocation on user side
This commit is contained in:
parent
e08217e6ca
commit
aaac317c67
|
@ -623,10 +623,10 @@ float lovrColliderGetMass(Collider* collider) {
|
||||||
void lovrColliderSetMass(Collider* collider, float mass) {
|
void lovrColliderSetMass(Collider* collider, float mass) {
|
||||||
JPH_MotionProperties* motionProperties = JPH_Body_GetMotionProperties(collider->body);
|
JPH_MotionProperties* motionProperties = JPH_Body_GetMotionProperties(collider->body);
|
||||||
Shape* shape = collider->shape;
|
Shape* shape = collider->shape;
|
||||||
JPH_MassProperties* massProperties;
|
JPH_MassProperties massProperties;
|
||||||
JPH_Shape_GetMassProperties(shape->shape, massProperties);
|
JPH_Shape_GetMassProperties(shape->shape, &massProperties);
|
||||||
JPH_MassProperties_ScaleToMass(massProperties, mass);
|
JPH_MassProperties_ScaleToMass(&massProperties, mass);
|
||||||
JPH_MotionProperties_SetMassProperties(motionProperties, JPH_AllowedDOFs_All, massProperties);
|
JPH_MotionProperties_SetMassProperties(motionProperties, JPH_AllowedDOFs_All, &massProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lovrColliderGetMassData(Collider* collider, float centerOfMass[3], float* mass, float inertia[6]) {
|
void lovrColliderGetMassData(Collider* collider, float centerOfMass[3], float* mass, float inertia[6]) {
|
||||||
|
|
Loading…
Reference in New Issue