mirror of
https://github.com/zeldaret/botw
synced 2026-07-26 14:31:32 -04:00
ksys/phys: Finish RigidBodyParam (add createEntityShapeBody)
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user