i'm gonna bust a blood vessel X-(

hey guys ! i’ve been strugelling with a camera setup for a couple of days now and i’ve allmost nailed it, but i can’t get it to function the exact way i want and it’s driving me crazy, this is my check list of things that i wanted to happen :

  • scene contains a model and two cameras, one outisde the model, one inside the model
  • the outside camera pivots around the model using mouse movement, the inside camera pivots around it’s own axes using mouse movement ( the pivoting occurs only when left click is pressed )
  • switching between cameras is done via 2 keyboard “shortcuts”

here is a snippet of the script that does the switching between cameras

1 if selectOutsideCam.isPositive():
2 if clickSensor.isPositive():
3 # do oustide camera stuff

4 if selectInsideCam.isPositive():
5 if clickSensor.isPositive():
6 # do inside camera stuff

my problem is that i have to keep both the "shortcut " for the camera and left click pressed in order to get the pivoting
what i want to do is move the camera without keeping the “shortcut pressed” ( just like you would in blender’s viewport fro example ) so can anyone help pleaseee?

if my previous explanation was confusing, i’m trying to get the kind of action that a light switch has, as in you just press your button and the light shines, you don’t have to keep the button pressed in order for the light to stay on
please tell me if this is too difficult or too easy

How about something more like this:

Have a property on the object doing the switching called “cam”. Have your selectOutsideCam and selectInsideCam functions change the cam property. Then, in your script, depending on what cam is, then allow the movement.

1 if cam==1:
2 if clickSensor.isPositive():
3 # do oustide camera stuff

4 if cam == 2:
5 if clickSensor.isPositive():
6 # do inside camera stuff

thank you Sambassador :slight_smile: , it’s one of the things i’ve been trying but i can’t figure out how to get the property value

Ah. Sorry, forgot to mention that.

To access an object’s properties (the properties added in the logicbricks window, not defined in python) in the script, you use the own object. You can define the owner by the command
own = cont.getOwner()

Then you can access the properties of that object by own.cam (if you have a property named cam on your object).

So your script would look a bit more like this:
1 if own.cam==1:
2 if clickSensor.isPositive():
3 # do oustide camera stuff

4 if own.cam == 2:
5 if clickSensor.isPositive():
6 # do inside camera stuff

Hope that helps.

you are my saviour man :smiley: thank you