From BlenderWiki

Jump to: navigation, search

If you want to document Blender 2.5 features please edit pages under Doc:2.5/Manual.
If a "2.5" page doesn't exist please copy the text from 2.4x Manual and edit the new page (i.e. you should paste the wikitext from this 2.4x page to this new 2.5x page and then update the latter with 2.5 features)


[edit] Game Logic

Game Logic is what causes anything to happen in the game. It is designed to provide a powerful tool to set up the logic through a graphical interface. The blocks (or “bricks”) represents preprogrammed functions which can be tweaked and combined to create the game/application. The system is broken up in three parts: sensors, controllers and actuators. Sensors senses when things happens, such as a collision, a key press, mouse movement. Sensors are linked to controllers, which compare them and activate actuators.

When loading the Logic panel (context) for the first time, either by pressing F4 or selecting the logic panel button (Image:GM_Selecting_the_Game_Logic_Pannel.png), you will see something similar to the image below.

The Logic context.

To give you a better understanding of the Logic panel, we have expanded some of the menus and numbered them in the image below. We will look at each section individually as numbered in the image below.

The different parts of the Logic context.


[edit] 1 Associated Object(s)

Logic for several objects.

Logic in the Blender game engine is attached to Objects. Objects are listed by their name and appear in the logic window when they are selected. You can select a single object as in the picture above, or you can select multiple objects as in the picture to the right.

An object’s logic is only visible when the object(s) associated with that logic are selected.

[edit] 2 Physics

These settings control how an object behaves in the game. The object type menu defines if an object is a:

  • Soft body - Physical, deforms on collision.
  • Rigid body - Physical.
  • Dynamic - Physical, stays upright.
  • Static - Physical, but unaffected by gravity.
  • Sensor - For advanced sensoring options (release notes).
  • No collision - Nonphysical.
  • Occluder - Stops the objects behind them from being sent to the GPU, to save performance (release notes).

The other settings depend of the object type, only the relevant settings will be visible. For some types there is also an Advanced menu with more options. Some settings are per material and can be accessed in by pressing the DYN button in the Material panneau, Material sub-context.

For more physics and culling options see Mist/Stars/Physics tab, in the World sub-context.

A more in-depth look at this is available on the page Object type.

[edit] 3 Properties

Properties are like variables in other programming languages. They are used to save and access data associated with an object. The following types are available:

  • Timer - Starts at a defined number and counts up.
  • String - Holds text.
  • Float - Holds decimal numbers between -10000.000 and 10000.000.
  • Integer - Holds integer numbers between -10000 and 10000.
  • Bool - Is either True or False.

For a more in-depth look, see Properties.

[edit] 4 Sensors

Sensors begin all logic actions. Sensors “sense” things, such as a nearby object, a key pressed on the keyboard, timed events, etc. When a sensor is triggered, a pulse is sent to all linked controllers.

For a more in-depth look, see Sensors.

[edit] 5 Controllers

Controllers handle the logic, evaluating pulses from sensors and sending pulses to actuators in response. The different kinds of controllers are:

  • AND - All connected sensors must be positive to send a positive pulse.
  • OR - One or more connected sensor has to be positive.
  • XOR - Exclusive Or: one, and only one, connected sensor has to be positive.
  • NAND - Not And, inverted And controller.
  • NOR - Not Or, inverted Or controller.
  • XNOR - Exclusive Nor controller.
  • Expression - Write your own expression.
  • Python - Control the sensor with a python script or module.

For a more in-depth look, see Controllers.

[edit] 6 Actuators

Actuators affect objects or the game in some way. Actuators change motion, sound, properties, objects, etc. These changes can be in other objects, physics, properties or they can cause trigger events for other logic bricks.

For a more in-depth look, see Actuators.

[edit] 7 Links

Links (7a) are the direction of logical flow between objects. Link lines are drawn by LMB File:Template-LMB.png dragging from one link node (7b) to another. Links can only be drawn from Sensors to Controllers or Controllers to Actuators. Sending nodes (the yellow circles found on the right-hand side of Sensors and Controllers) can send to multiple reception nodes (found on the left-hand side of Controllers and Actuators). Reception nodes can like wise receive multiple links.

You cannot directly link Sensors to Actuators. Actuators cannot be linked back to Sensors. If you desire to cause a Sensor to activate after an Actuator has completed, use the actuator sensor.



[edit] Subpages

  1. Actuators
  2.    2D Filters
  3.    Action
  4.       Common
  5.    Edit Object
  6.    IPO
  7.    Motion
  8.    Property
  9.    Scene
  10.    Shape Action
  11. Controllers
  12. Object type
  13.    Dynamic
  14.    No collision
  15.    Occluder
  16.    Rigid body
  17.    Sensor
  18.    Soft body
  19.    Static
  20.    actor
  21.    anisotropic
  22.    bounds
  23.    damp
  24.    do fh
  25.    form
  26.    ghost
  27.    invisibile
  28.    mass
  29.    no sleeping
  30.    radius
  31.    rot fh
  32.    rotdamp
  33. Properties
  34. Sensors
  35.    Sensor pulses


Redirects to fix

  • Doc:Manual/Game Engine/Logic/Actors → Doc:Manual/Game Engine/Logic/Object type