Pivot/model open/close door?

Blitz3D Forums/Blitz3D Programming/Pivot/model open/close door?

You could move the door with PositionMesh to change it's centerpoint. Ie: PositionMesh door, MeshWidth(door) / 2, 0, 0

For the movement, you can use KeyHit() to determine if the key was hit for the first time, after that use KeyDown to determine wheter it's down or not.

I would use a 'flag' variable, say 'doorphase' that is zero at the start of the program.
This variable determines the behaviour of the door.
I would make three states:
1. door opens
2. door shuts
3. door opens completely

These stages can be handled by a Select..Case structure:
Select doorphase

Case 1
..
Case 2
..
Case 3
..

End Select

Instead of checking the position/rotation of the door, I would use a variable to count, like this:
Case 1
 Move door, 0.25, 0, 0
 time = time + 1
 if time = 30 then phase = 3


So, at the start of the program, 'doorphase' is zero.
Only when 'doorphase' is zero, the "H" key can be used.
When the key is hit, doorphase becomes one and the program executes all code that is after 'Case 1' in the Select part.
The door moves open. If the key isn't down anymore, it should shut again. (phase=2)
If the door is beyond a certain point (ie. time > 30), the door is 'unstoppable' and moves open completely. (until time = 50)
After that, doorphase should be four, preventing the door from being opened (any further).