Camera Simulation

Blitz3D Forums/Blitz3D Programming/Camera Simulation

skyfire1(Posted 2005) [#1]
i've been working on a stealth game and i'm wondering, is there a function that allows an entity to return true if it's sees another entity? kinda like a camera simulation. any help very much appreciated.


S_Seth(Posted 2005) [#2]
I believe that the command is EntityVisible(). Try using that and see if it works.


skyfire1(Posted 2005) [#3]
it didn't work :( ! i tried to do what you said but from what i could tell, entityvisible() returns true if both entities EXIST (in other words, it doesn't work like entityinview()).

does anyone know a function that works like entityinview() but is intended for entity seeing entities instead of cameras seeing entitys?


Shifty Geezer(Posted 2005) [#4]
Do you need to set EntityPick modes for the entities first?


skyfire1(Posted 2005) [#5]
huh?


Dreamora(Posted 2005) [#6]
you have to do a mathematical check with view frustrum and bounding boxes/spheres for each entity that shall have a "view".


puki(Posted 2005) [#7]
Another option is to have a hidden mesh shape protruding from the camera. I assume you mean a simulated, security-type, camera, not a game-play camera.

You could set the alpha to 0 (to make it invisible) then just do a collision check between the camera view shape entity and the player entity.

'cameraview=CreateCone()' is a quick way of setting the sucker up.

'EntityAlpha cameraview,1' to make it invisible from view, but it is still there and active in collisions. You could even make it 'sweep' left/right, etc so that people can sneak past its view.

ps. the cone shape is not the best shape to use - you would really need a custom cone that is flat at the point where it strikes the ground.


Matty(Posted 2005) [#8]
If you are going to use entityvisible() you need to set the pick mode of the entity which will 'obscure' vision - usually to entitypickmode 2 (polygon as opposed to sphere/box). If you don't want your 'camera' to be able to look in all directions then do a simple check using the TFormNormal command, transforming the position vector of the object being viewed relative to the camera from the world space to camera space. Assuming you want the camera to be able to see things only within a small cone directly forwards then you would check that the Tformedz() value is greater than a certain number.


jfk EO-11110(Posted 2005) [#9]
EintityVisible may be used when the walls etc that may obscure the view are pickable:
entitypickmode map,2
Of course, everything must be pickable, the player too.

additionally, to make sure the enemy won't see the player when he sneakes behind his back etc, use this code:
http://www.blitzbasic.com/codearcs/codearcs.php?code=532