0
$\begingroup$

I have explore BGE for a long time.But I only know about how to use and,python and nand controller.Can anybody help me about how to use or,xor,nor,xnor and expression controller.

Many thanks for any answers

$\endgroup$
1
$\begingroup$

This question can be answered by reading the Blender manual, section Game Engine by clicking here.

But as I'm answering and not commenting, I'll give an answer.

AND

Activates all connected actuators when all connected sensors are active.

NAND

Activates all connected actuators when none connected sensors are active.

OR

Activates all connected actuators when one or more (or all) connected sensors are active.

NOR

Activates all connected actuators when one or more (or all) connected sensors are not active.

XOR

Activates all connected actuators when one, and only one connected sensor is active.

XNOR

Activates all connected actuators when one, and only one connected sensor is not active.

Expression

Activates all connected actuators when the evaluated expression is true. A remark about this one: this controller is (after Python) the most powerful one, as you can evaluate complex expressions, which could demand several sensors, on a single line.

On Expression controller you can:

  • Mix the previous controllers. Example: sensor1 AND sensor2 OR sensor1 AND sensor3.
  • Check values of properties without the need of an Property sensor. Example: property > 0 OR property < 10.

I seriously recommend you to learn Python, but if you don't, learning the Expression controller can help you in making complex logic while avoids 'spaghetti code' on logic bricks.

Python

As the name says, executes Python code. However, there's two modes: Script and Module.

Script mode runs a Blender text block. Using this mode is highly disencouraged, as it is pretty slow (as Python compiles it to bytecode each frame it runs) and harder to maintain (as it belongs to the blend file). This mode is only kept for backward compatibility.

Module runs a Python function. This function can be present inside a Blender text block or an external Python script (in both cases, the scripts must end with the extension .py). The field of the controller is a path to the function, which could follow the pattern script.function, folder.script.function, folder.subfolder.script.function, or any other pattern which fits your Python script.

$\endgroup$

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.