Pivot/model open/close door?

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

simply model it and export from the modeller with the pivot(axis) where you want it to rotate (ie at the edge). Or if not doing modelling, do a createcube and positionmesh the verts by half the meshsize (or fitmesh prob better) as suggested above.

Then just create a 4 state latch and trigger but using turnentity: (im using custom types here (d\) but you could use arrays or just a variable if you have only one door).

**edit, added a working vrsion to codearcs
http://www.blitzbasic.com/codearcs/codearcs.php?code=1970


You could improve the above with an incremental doorspeed to get a slamming effect, but remember to reset the angle once it has passed the stops ie:

if entityyaw(d\door) <0 then rotateentity d\door,0,0,0