Jump to content

GetDistance not working properly with Doors?


niston

Recommended Posts

I'm having a little WTF moment, trying to use GetDistance() between two doors.

 

The "physical" situation is like this:

 

 

[Door 1] ---- [Door 2]----------------------------[Door 3]

 

 

Yet, when I call refDoor1.GetDistance(refDoor2), I'm getting the very exact same value back as when I call refDoor1.GetDistance(refDoor3): The engine insists that Door2 and Door3 are both 125 units from Door1.

 

This result is complete rubbish and very clearly not true: https://imgur.com/a/prn9kCn

 

I checked that my refDoor1 reference is indeed pointing at Door1, that refDoor2 is indeed pointing at Door2 and that refDoor3 is indeed pointing at Door3. No mix up there, and nothing is 'none' either.

 

 


[CRP:ElevatorController < (A605376A)>]: Distance inner FRONT door [CRP:ElevatorDoor < (A604F309)>] -> main door [CRP:ElevatorDoor < (A604F313)>] = 125.000000

[CRP:ElevatorController < (A605376A)>]: Distance inner BACK door [CRP:ElevatorDoor < (A604F30A)>] -> main door [CRP:ElevatorDoor < (A604F313)>] = 125.000000

 

Is GetDistance() perhaps broken, like so many other things? Can somebody confirm GetDistance() doesnt work properly on Doors or something?

 

 

EDIT: I found the problem. It's because of the way the 3d of those doors is setup; their origin is right in the middle between Door1 and Door2. It also means my strategy wont work at all and a super nasty hack will be required instead. GRRRRRRRRRRR!!!! >=(

Link to comment
Share on other sites

Put a trigger that covers each door, link the doors to the triggers, attach the triggers to the helper (at least the triggers for the doors that should move with the cart). When you want to get the distance to the door, instead of :

 

refDoor1.GetDistance(refDoor3)

 

use

 

refDoor1.GetLinkedRef().GetDistance(refDoor3.GetLinkedRef())

 

On the other hand, if what you want to know is what door should open, take in to account that a trigger box can start a OnTriggerEnter event or OnTriggerLeave event onto another trigger (said with other words, from a programming stand point, triggers do collide) so, if you make the triggers wide enough, you can use those events to know what cart door's trigger is colliding with a trigger of a wall door.

Edited by DieFeM
Link to comment
Share on other sites

In case a floor has just a single "outer" door, the mechanism was to determine on which side of the elevator that single "outer" door is located. So that the elevator control logic may open the proper "inner" door.

 

I'm now checking the rotation of the "outer" door, relative to the rotation of the elevator cart. If the relative rotation is zero, it's front side. If relative rotation is 180°, the door must be on the back side.

Works reasonably well.

 

The whole thing is moot in case of two outer doors. Both inner doors are then operated.

 

There is already a trigger on the cart (not shown below). It's to switch followers into close-up mode when boarding the elevator, and back to normal again when leaving the cart.

 

The script supports an arbitrary number of floors (no array limit) at arbitrary spacing, with up to two doors each. Floor enumeration is automatic, no configuration required.

 

My test cell:

 

 

CeCcSiO.png

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...