Spawning Active Cameras

Then explain how it still accesses that camera after I kill the first one. See my demo video.

That’s how it’s explained for spawning new objects in all the tutorials I watched.

I don’t know about any of that other stuff you said. I’ve gotten so much bad information around here so far that I would need a better explanation before I believed it. How do you know this for certain? You can’t just look while the game is running.

It appears to work very well now. Thank you very much!

I’ll study what you did and learn from it. Appreciated.

1 Like

move the tank to a different location in the hidden layer and you will see
the camera is accessed even though its in a hidden layer
it also happens for steering actuator where it’s possible to target to an obj in a hidden layers

How right you are. I guess you know what you’re talking about. My apologies for any doubts.

So when you add a script to an And and it’s branched off of a sensor that also points to another And going to an actuator, the python script loads and runs before the actuator is initiated? I’m just trying to understand the flow of logic and order of execution.

While I have your attention, is there a simple way to set the order of execution of actuators on an object?

It says in the console (Window > Toggle System Console). Once I saw that, I looked at your tank on the hidden scene and saw that it tried adding new overlays.

Glad I could help!

Back in Blender 2.5 when I was using it, it did it in the order that you added the logic bricks (madness, I know). It’s probably still the same now.

You’re not going to like it… but yes, you can do it with Python. Or, if my above statement is correct, then you can add the actuators in order and hope that they activate in the same order.
May I ask why you need a specific order? Most things are going to start happening at the same time anyway, so actuator order shouldn’t make any difference. I’m not even sure if sending messages in a different order will result in the sensors receiving them in the same order.

Or, to put it another way, let us know what you’re trying to achieve and hopefully we can come up with a way that doesn’t rely on actuator order.

I’m just trying to understand how Blender handles the logic bricks. I was thinking of this initially in terms of spawning, by plugging two Edit Object actuators into the same And, where one removes an object and the other adds one. I was just considering ways to implement the camera parenting.

I appreciate the help. I’ll post again when I have another problem or question, which I;m sure I will before long. :smile:

there is a bookmark symbol in the controller that sets the order
you can also switch states and use delay sensors.

and here is a topic about the game loop by Professor Monster

2 Likes

The way I understand it, you say on one frame what you want to happen, and it happens by the next frame. For example, you send a message on frame 1. On frame 2, any sensors that are listening for that message are active. Or, you add an object on frame 1, it exists by frame 2.
That’s why I mentioned the order doesn’t matter that much, because it all happens by the next frame.
This is also why firing off multiple of the same message doesn’t activate things multiple times, since they all just make the sensor active on the next frame.

Having objects appear the next frame is not ideal if you want to spawn lots of things and parent them all together, so Python has a function on the ‘add object actuator’ to instantly add, which means it’s immediately available to move/parent/etc.

Due to the way I wrote that camera script, it won’t matter if the old tank still exists when the new one is added. The camera won’t automatically change to the new tank though, if you’re watching the old one when it dies.

Take what I say with a grain of salt. Most of this comes from practical experience having used Blender extensively many years ago. Some of what I recall might be wrong, or have changed in newer versions (particularly in UPBGE). I remember at the time when struggling through problems that other peoples little insights to the workings helped me figure out why things were reacting weirdly. I hope my messages provide the same assistance.

1 Like

Thank you @TheDave, you are a big help. For me, understanding how things work is important. Your explanation makes it all a little bit clearer.

I will be posting another python-related question in a minute or two. Perhaps you can look at that?

1 Like