entitydistance in x & z ONLY??

Blitz3D Forums/Blitz3D Beginners Area/entitydistance in x & z ONLY??

chwaga(Posted 2007) [#1]
I'l trying to make an automatic door that slides upwards if the character gets too close to it (and slides down when far away and up). entitydistance wont work because as the door moves up, the distance between the two increase, and unless the character itself is actually moving, it will remain stationary (the two arguments of "if distance is this far then move down, but if distance is this close then move up" condradicting eachother, causing it to kinda vibrate in place)

thanks :D


big10p(Posted 2007) [#2]
Either:

x# = EntityX(door) - EntityX(player)
z# = EntityZ(door) - EntityZ(player)
dist# = Sqr(x*x + z*z)

Or:

Stick a stationary pivot at the door position and do distance check against that, instead of the door mesh.


chwaga(Posted 2007) [#3]
thanks, that should do it, (i'm gonna have a ton of doors, so the stationary pivot would just take too long, but the above equation oughta do it, thanks!)


big10p(Posted 2007) [#4]
Well, you could always create the pivots and parent the doors to them. The choice is yours, though. ;)


chwaga(Posted 2007) [#5]
would this work for 2d also?


Matty(Posted 2007) [#6]
yes


chwaga(Posted 2007) [#7]
ok, thanks.