Building interior walls created with editor

This commit is contained in:
2026-01-02 01:41:58 +03:00
parent d6d61229f8
commit 49fc547295
8 changed files with 1733 additions and 205 deletions

View File

@@ -895,8 +895,14 @@ public:
msp.ScaleToMass(mass);
bodySettings.mMassPropertiesOverride = msp;
}
return createBody(bodySettings, listener);
}
JPH::BodyID id = createBody(bodySettings, listener);
if (shape->GetType() == JPH::EShapeType::HeightField) {
JPH::BodyInterface &body_interface =
physics_system.GetBodyInterface();
body_interface.SetFriction(id, 1.0f);
}
return id;
}
JPH::BodyID createBody(const JPH::Shape *shape, float mass,
Ogre::SceneNode *node, JPH::EMotionType motion,
JPH::ObjectLayer layer,
@@ -906,20 +912,8 @@ public:
const Ogre::Quaternion &rotation =
node->_getDerivedOrientation();
std::cout << "body position: " << position << std::endl;
JPH::BodyCreationSettings bodySettings(
shape, JoltPhysics::convert(position),
JoltPhysics::convert(rotation), motion, layer);
if (mass > 0.001f) {
JPH::MassProperties msp;
msp.ScaleToMass(mass);
bodySettings.mMassPropertiesOverride = msp;
}
JPH::BodyID id = createBody(bodySettings, listener);
if (shape->GetType() == JPH::EShapeType::HeightField) {
JPH::BodyInterface &body_interface =
physics_system.GetBodyInterface();
body_interface.SetFriction(id, 1.0f);
}
JPH::BodyID id = createBody(shape, mass, position, rotation,
motion, layer, listener);
id2node[id] = node;
node2id[node] = id;
return id;