Skip to content

Commit 9de53ee

Browse files
committed
fix elevator door direction
1 parent 1b5333b commit 9de53ee

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

src/OpenCOVER/plugins/hlrs/Revit/Elevators.cpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ bool ElevatorPart::update(osg::Vec3& viewerPosition)
248248
doorFraction = 1;
249249
state = DoorOpen;
250250
}
251-
float doorPos = doorFraction * openingDistance * (doorNumber+1);
251+
float doorPos = direction * doorFraction * openingDistance * (doorNumber+1);
252252

253253
osg::Matrix newTrans = transformNode->getMatrix();
254254
newTrans.setTrans(initialTranslation + osg::Vec3(doorPos, 0, 0));
@@ -277,7 +277,7 @@ bool ElevatorPart::update(osg::Vec3& viewerPosition)
277277
doorFraction = 0;
278278
state = DoorClosed;
279279
}
280-
float doorPos = doorFraction * openingDistance * (doorNumber+1);
280+
float doorPos = direction * doorFraction * openingDistance * (doorNumber + 1);
281281

282282
osg::Matrix newTrans = transformNode->getMatrix();
283283
newTrans.setTrans(initialTranslation + osg::Vec3(doorPos, 0, 0));
@@ -388,17 +388,25 @@ void Elevator::addPart(const std::string &familyName, const std::string &subType
388388
if (familyName.substr(0, 5) == "Cabin")
389389
{
390390
cabin->doors.push_back(ep);
391-
if (subType.substr(16, 4) == "ight")
391+
if (subType.length() < 18 || subType.substr(16, 4) == "ight")
392392
{
393-
393+
ep->direction = 1;
394394
}
395395
else
396396
{
397-
ep->doorNumber *= -1;
397+
ep->direction = -1;
398398
}
399399
}
400400
else
401401
{
402+
if (subType.length() < 18 || subType.substr(16, 4) == "ight")
403+
{
404+
ep->direction = 1;
405+
}
406+
else
407+
{
408+
ep->direction = -1;
409+
}
402410
ElevatorPart *landing=nullptr;
403411
for (const auto &landingPart : landings)
404412
{

src/OpenCOVER/plugins/hlrs/Revit/Elevators.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class ElevatorPart: public vrui::coAction
5858
int levelNumber;
5959
ElevatorPart *buttonLanding; // landing this button is for.
6060
int doorNumber;
61+
int direction = 1;
6162
virtual int hit(vrui::vruiHit *hit);
6263
virtual void miss();
6364

0 commit comments

Comments
 (0)