Better boat handling

This commit is contained in:
2025-11-30 18:28:26 +03:00
parent cd82fb0eed
commit 5b014dcb65
21 changed files with 938 additions and 230 deletions

View File

@@ -6,6 +6,7 @@
#include "GameData.h"
#include "Components.h"
#include "EventTriggerModule.h"
#include "PhysicsModule.h"
#include "physics.h"
#include "loader.h"
@@ -1868,15 +1869,23 @@ void SceneLoader::setupPhysicsBody(Ogre::SceneNode *node,
layer = Layers::NON_MOVING;
mass = 0.0f;
}
#if 1
JPH::ShapeRefC com_shape =
JoltPhysicsWrapper::getSingleton()
.createOffsetCenterOfMassShape(
Ogre::Vector3(0, -5.5f, 0.5f),
Ogre::Vector3(0, 0, 0.45f),
shape);
JPH::BodyID id =
JoltPhysicsWrapper::getSingleton().createBody(
com_shape.GetPtr(), mass, pNode, motion,
layer);
JoltPhysicsWrapper::getSingleton().setFriction(id, 0.95f);
#else
JPH::BodyID id =
JoltPhysicsWrapper::getSingleton().createBody(
shape.GetPtr(), mass, pNode, motion,
layer);
#endif
LogManager::getSingleton().logMessage(
"[SceneLoader] Node: " + pNode->getName() +
" btRigidBody created: " + collisionBodyType);
@@ -1887,6 +1896,7 @@ void SceneLoader::setupPhysicsBody(Ogre::SceneNode *node,
id);
/* do not add body to physics yet */
base_e.set<JPH::BodyID>(id);
base_e.set<ECS::CachedMass>({mass});
} else if (collisionBodyType == "ghost") {
/* TODO: later */
}