zones, areas...

does anyone know what is the best way to make a zone where some actions are started… I mean if there would be a box and you would go into the box then it would be like a silent zone, where all sounds are disabled or a water zone or something… or if you’re in the box everything will turn red or something… dunno if my english is goood, but try to understand… :slight_smile:

Not sure how good your skills are with python, but here’s an example of switching to different cameras depending which ‘zone’ of a scene the player is in:

(Note this is currently a 2D system).



g = GameLogic
c = g.getCurrentController()
o = c.getOwner()

if o.getPosition()[1] > -25.0:

	Camera1 = c.getActuator("Camera 1")
	g.addActiveActuator(Camera1,1)

elif ((o.getPosition()[1] < -25.0) and (o.getPosition()[1] > -45.0)):

	Camera2 = c.getActuator("Camera 2")
	g.addActiveActuator(Camera2,1)

elif ((o.getPosition()[1] < -45.0) and (o.getPosition()[1] > -75.0) and (o.getPosition()[0] < 10.0)):

	Camera4 = c.getActuator("Camera 4")
	g.addActiveActuator(Camera4,1)

elif ((o.getPosition()[1] < -45.0) and (o.getPosition()[1] > -75.0) and (o.getPosition()[0] > 10.0)):

	Camera3 = c.getActuator("Camera 3")
	g.addActiveActuator(Camera3,1)

elif ((o.getPosition()[1] < -75.0) and (o.getPosition()[1] > -100.0)):

	Camera5 = c.getActuator("Camera 5")
	g.addActiveActuator(Camera5,1)

elif o.getPosition()[1] < -100.0:

	Camera6 = c.getActuator("Camera 6")
	g.addActiveActuator(Camera6,1)


This could easily be modified to adjust properties in different areas of a scene.

For a non-cubic zone, this method wouldn’t be suitable. You’d need another way of doing it, perhaps with an array of near sensors or collision detection of the floor mesh.