1
$\begingroup$

This is for the BGE... I have a Near sensor that, when triggered, I want to send a message to another object, triggering that object to initiate a Steering actuator. I don't know how to use the logic bricks for sending messages and I have little experience with using properties, but I know that's what I need to use. Can anyone help me?

$\endgroup$
3
$\begingroup$

This is actually relatively easy to do. For simplicity, we will use two cubes.

On cube1, we can add a Keyboard sensor, connected to an And controller, which is connected a Message actuator.

enter image description here

The "To" field on the message actuator doesn't actually need to be filled in. If it is left blank, the actuator will simply broadcast the message to all objects, instead of just one. Since only one object will be listening for the message, the "To" field doesn't matter here. You could also set the "Subject" field to whatever you want.

On Cube2, we simply need a Message sensor listening for the message that Cube1 sent out. We can do that by putting the message Cube1 is sending in the "Subject" field on the message sensor on Cube2. That message sensor should connect to an And controller, which should connect to a property actuator. The easiest property for this will be a Boolean property. Add one, and name it whatever you want. Then, In the property actuator, put in the name of the property you just created. Set the operation to "Assign" and the value to "True." Now, add a property sensor, with that same Boolean in the "Property" field. you want this sensor to check if the Boolean property you created is true. To do this, set the "Value" field to True. Enable true level triggering. This will make it so that as long as the property is true, the sensor will constantly be telling the connected bricks to run. You can connect that property sensor to an And controller, and connect that your steering actuator.

enter image description here

As long as the property is true, the steering actuator will be running. You can also easily do the same sort of thing to assign the property False, to deactivate the steering actuator.

$\endgroup$
  • $\begingroup$ Thank you for the explanation. I was able to figure it out last night, but instead of using a property like you suggested, I just have the first object send a message when the Near sensor is triggered, then the second object just watches for that message and activates the steering actuator when it receives it. No properties needed... just six logic bricks. Thanks anyway. I tagged your answer as the accepted one. $\endgroup$ – Anthony Forwood Jun 4 '16 at 22:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.