Logic IF's not working... (see example)

I have a nice scene going and want to use the NUMPAD keys to control cameras. I’ve made four camera so far and can switch to them when the game is running. But i want to add movement to them as well.

As i still havent found a tutorial on complex camera movement on the internet (such as orbit an object or follow a complex path), i’m trying to use “IF logic” but its not working.

I have it set that when the cameras are activated (using the numpad buttons) a property actuator is activated to which sets a made up variable “NUMCAM” to 1,2,3 or 4.

I have then connected two sensors for the moving cameras, an always sensor and a “property” sensor. Which should mean that the camera only moves when the NUMCAM value is as the sensor checks for it 1,2,3 or 4.


Wrong, the cameras move all the time, ignoring the second sensor.

Also its blender 2.49b.


DMONIO.blend (624 KB)

You do not have one NUMCAM, you have 4 of them - one for each camera.
That means you set them always to the same values. To debug that add an property NUMCAM by klicking “Add Property”. It should be int. Enable the “D” button to see its value at runtime.

You can combine the logic by selecting all cameras (<shift><RMK>).
Now you can connect the logic brick between the cameras. Make sure

  • all property sensors and all property actuators are at the same object (it does not matter which one)
  • the motion actuator should be at the moving camera (Camera, Camera.001)
  • the trackto actuator should be at the tracking camera (Camera.001)
  • the keyboard sensors can be at any object
  • the camera set actuators can be at any object

I hope it helps

OK i’ve added the property NUMCAM to every camera, it still doesn’t work though, do i need to set it as a global variable somewhere?

I’m afraid i dont understand what you’re saying after the first bit. What logic bricks between the cameras need connecting?
They all have a NUMCAM sensor. They all all configur NUMCAM when activated. Having added that property i see now that CAMERA no longer moves at all, but camera.001 does wait until activated before starting to move (correct behavoir).

That is the problem not each camera should have the property - one of them needs it.

So if i assign a “property” actuator it only applies the property to the object in question, not to the whole game? (I.e. a global variable). How can i then make the other cameras sense the camera’s NUMCAM property if its a different camera which stores the property?

That’s the reason, why you should connect the logic bricks of the objects together.

Here is an example:

The property sensors and property actuators SHOULD be at the object (here Cube) with the property. the controller inbetween does not matter. It can be anywhere.

There is no real need for a global variable.
But if you want one, you need to use a Python controller.