mirror of
https://github.com/rwengine/openrw.git
synced 2024-09-15 06:52:34 +02:00
Newly created instance objects sleep immediately
This improves performance immediately after startup.
This commit is contained in:
parent
4adcaa670c
commit
711aad7701
@ -26,33 +26,39 @@ InstanceObject::InstanceObject(GameWorld* engine, const glm::vec3& pos,
|
||||
: GameObject(engine, pos, rot, modelinfo)
|
||||
, scale(scale)
|
||||
, dynamics(dyn) {
|
||||
if (modelinfo) {
|
||||
changeModel(modelinfo);
|
||||
setPosition(pos);
|
||||
setRotation(rot);
|
||||
if (!modelinfo) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Disable the main island LOD
|
||||
if (modelinfo->name.find("IslandLOD") != std::string::npos) {
|
||||
setVisible(false);
|
||||
}
|
||||
changeModel(modelinfo);
|
||||
setPosition(pos);
|
||||
setRotation(rot);
|
||||
|
||||
// Make sure bouys float on water
|
||||
if (modelinfo->name.find("bouy") != std::string::npos) {
|
||||
setFloating(true);
|
||||
}
|
||||
if (body) {
|
||||
body->getBulletBody()->setActivationState(ISLAND_SLEEPING);
|
||||
}
|
||||
|
||||
/// @todo store path information properly
|
||||
if (modelinfo->type() == ModelDataType::SimpleInfo) {
|
||||
auto simpledata = static_cast<SimpleModelInfo*>(modelinfo);
|
||||
for (auto& path : simpledata->paths) {
|
||||
engine->aigraph.createPathNodes(position, rot, path);
|
||||
}
|
||||
}
|
||||
// Disable the main island LOD
|
||||
if (modelinfo->name.find("IslandLOD") != std::string::npos) {
|
||||
setVisible(false);
|
||||
}
|
||||
|
||||
if (SimpleModelInfo::isDoorModel(modelinfo->name)) {
|
||||
setStatic(true);
|
||||
// Make sure bouys float on water
|
||||
if (modelinfo->name.find("bouy") != std::string::npos) {
|
||||
setFloating(true);
|
||||
}
|
||||
|
||||
/// @todo store path information properly
|
||||
if (modelinfo->type() == ModelDataType::SimpleInfo) {
|
||||
auto simpledata = static_cast<SimpleModelInfo*>(modelinfo);
|
||||
for (auto& path : simpledata->paths) {
|
||||
engine->aigraph.createPathNodes(position, rot, path);
|
||||
}
|
||||
}
|
||||
|
||||
if (SimpleModelInfo::isDoorModel(modelinfo->name)) {
|
||||
setStatic(true);
|
||||
}
|
||||
}
|
||||
|
||||
InstanceObject::~InstanceObject() = default;
|
||||
|
Loading…
Reference in New Issue
Block a user