Facing cam or not?

Blitz3D Forums/Blitz3D Programming/Facing cam or not?

Craig H. Nisbet(Posted 2003) [#1]
Anyone know how to write a routine that will check if an entity is facing the camera or not? Probably would look like;

IsFacingCam(Camera,Entity,FacingRange)

Facing Range would be a degree range that it would consider the front of the entity. Example: 90 would cover the intire front of the entity. It would check if the camera is within a -90 to 90 on the Pitch,Yaw,and Roll relative to the entity in question. I'm not sure if Roll could even be in this.

I hope this makes sense.
Any ideas?


jfk EO-11110(Posted 2003) [#2]
This might be useful:
http://www.blitzbasic.com/codearcs/codearcs.php?code=532


Rob(Posted 2003) [#3]
tformpoint I think. transform the object into camera space and check if tformedz is <0 or >0

(experiment)

[edit]: that tells us if the object is behind us, sorry! sleepy...


(tu) sinu(Posted 2003) [#4]
you'd still need to check the x value aswell cos you could fasr right or left and still out of view.

ps tformpoint sounds the best way though. Also use tformvector to check which way it's facing ie anything anything below abs(1) on the x vector and <0 on the z could tell you the player is facing in the vacinaty of the camera.Based on how you have things setup.


BODYPRINT(Posted 2003) [#5]
just use the Deltayaw and Deltapitch commands to see how much angle there is for your object to face the other object.

You will need the Blitz3D 1.85 update for these commands though.