ksys/phys: Finish RigidBodyParam (add createEntityShapeBody)

This commit is contained in:
Léo Lam
2022-02-13 18:58:34 +01:00
parent db72086c68
commit 3512b78627
3 changed files with 26 additions and 3 deletions
@@ -302,6 +302,28 @@ RigidBodyParam::createRigidBody(SystemGroupHandler* group_handler, sead::Heap* h
return list_body;
}
RigidBody* RigidBodyParam::createEntityShapeBody(RigidBody* linked_body,
SystemGroupHandler* group_handler,
sead::Heap* heap) const {
auto* linked_shape_body = sead::DynamicCast<RigidBodyFromShape>(linked_body);
if (!linked_shape_body)
return nullptr;
auto* body = RigidBodyFromShape::createEntityShapeBody(*info.rigid_body_name, getContactLayer(),
linked_shape_body, heap, group_handler);
if (!body)
return nullptr;
body->setUpdateRequestedFlag();
body->setMaxLinearVelocity(*info.max_linear_velocity);
body->setMaxAngularVelocity(*info.max_angular_velocity_rad);
body->setCenterOfMassInLocal(*info.center_of_mass);
body->updateCollidableQualityType(*info.toi);
body->processUpdateRequests();
return body;
}
ContactLayer RigidBodyParam::getContactLayer() const {
return contactLayerFromText(*info.layer);
}
@@ -168,8 +168,9 @@ struct RigidBodyParam : agl::utl::ParameterList {
SystemGroupHandler* group_handler, sead::Heap* heap,
CreateFixedBoxWithNoCollision no_collision = CreateFixedBoxWithNoCollision::No) const;
// TODO: types and names
void* createEntityShape(void* x, void* y, sead::Heap* heap);
/// @param linked_body Must be a RigidBodyFromShape.
RigidBody* createEntityShapeBody(RigidBody* linked_body, SystemGroupHandler* group_handler,
sead::Heap* heap) const;
ContactLayer getContactLayer() const;
GroundHit getGroundHit() const;