From BlenderWiki

Jump to: navigation, search

Sensores

Los Sensores son la causa por la cual la lógica hace algo. Puede haber eventos como un objeto cercano, una tecla presionada del teclado, de tiempo, etc. Cuando un sensor es gatillado, un pulso positivo es enviado a todos los controladores enlazados. The frame after un pulso negativo es enviado.


Visor de opciones de sensor

Arriba de la lista de sensores hay cuatro botones y un menú. Estos son para mostrar/ocultar los sensores. Son muy útiles, entonces los sensores innecesarios se pueden ocultar y los necesarios se pueden ver lo cual son más fáciles de alcanzar. Los sensores estan ordenados por objeto, cada objeto seleccionado aparecerá en la lista y debajo de cada objeto su respectivo sensor.

El menú etiquetado Sensors, parece una etiqueta pero es un menú. Tiene cuatro opciones:

  • Show Objects expande todos los objetos.
  • Hide Objects colapsa todos los objetos en una barra con sus nombres.
  • Show Sensors expande todos los sensores.
  • Hide Sensors colapsa todos los sensores en una barra con sus nombres.

Ambos pueden ser controlados individualmente por el sensor o el objeto.

También es posible filtrar que sensores se quieren ver:

  • Sel mostrar todos los sensores de objetos seleccionados.
  • Act mostrar solo los sensores de objetos activos.
  • Link mostrar los sensores que tienen un enlace con el controlador.
  • State: solo los sensores conectados a el controlador del estado actual se mostraran.



Opciones generales de objetos

Todo los objetos tienen dos botones, uno que es la etiqueta con su nombre, y otro etiquetado Add. El botonAdd añade un nuevo sensor a el objeto, el botón con el nombre del objeto es para colapsar la lista de objetos y esconder sus sensores. Un objeto sin sensor es automáticamente colapsado. Añadiendo un sensor automáticamente mostrara el objeto.


Opciones generales de sensor

Todos los sensores tienen una serie de botones, campos y un menú en común. Organizados en dos filas, sobre la primera fila, la cabeza del sensor:

  • X, cual borra el sensor.
  • Menú de tipo de sensor, mire sensor types debajo.
  • Nombre del sensor, es el nombre del sensor. Usado para acceder al sensor mediante Python. Needs to be unique among the selected objects.
  • Le sigue el “triángulo” botón para colapsar el sensor.

La fila de botones superior de cada sensor es la misma para cada tipo, estas son:

  • Nivel de pulso Verdadero, hace que el sensor le envie un pulso positivo mientras este activado.
  • Nivel de pulso Falso, hace que el sensor le envie un pulso negativo mientras este desactivado.
  • Campo de retraso (f), especifica cuanto tiempo va a pasar (en cada tick lógico) entre cada pulso. Esto es bueno para salvar rendimiento, al hacer las cosas menos frecuente de de lo que uno necesita.
  • Level, makes the sensor working over state changes. Mire this page para el sistema de estados.


Tap
Envía un pulso positivo sólo una vez aun cuando el sensor permanezca verdadero. Solo uno de los dos, Tap o Level, puede ser activado al mismo tiempo.
Cuando el parámetro Tap está puesto el sensor enviará un pulso in the next frame (NdT : ¿Cual seria la traducción exacta? : in the next frame), aun cuando el sensor esté siendo activado. Cuando deja de estar activado ningún pulso será enviado.
Si TRUE level triggering está pulsado, el par de pulsos TRUE/FALSE será repetido hasta que el sensor esté desactivado.

FALSE level triggering será ignorado cuando el parametroTap esté pulsado.

Los pulsos no serán invertidos cuando Inv esté pulsado pero el par de pulsos TRUE/FALSE será enviado cuando el suceso del sensor no esté presente.


  • Inv, invierte la salida, envia pulsos negativos en vez de positivos y vice versa.


  • Mire Sensor pulses para una mas detallada explicación de como la configuración de los sensores reaccionan.

GameLogic python API.

Tipos de sensor

Sensor Always "Siempre"

El sensorAlways es usado para hacer cosas que se nesesitan en cada tick lógico, o cada x tick lógico (con non-null f), o al inicio (con Tap).

Este sensor no tiene mas opciones aparte de las generales.

GameLogic python API.

Sensor Delay "Retraso"

El sensor Delay esta diseñado para retrasar reacciones con un numero de ticks lógicos. esto es útil si una acción debe realizarse antes que otra o también para eventos en el tiempo.

El sensor Delay tiene tres opciones:

  • Delay es el numero de ticks lógicos que el sensor espera para mandar el pulso positivo.
  • Duration es el tiempo que espera el sensor antes de mandar el pulso negativo.
  • Repeats hace que el sensor se reinicie después del retraso and duration time is up.

GameLogic python API.

Keyboard sensor

The Keyboard sensor is for detecting keyboard input, it can also save keyboard input to a String property.

The first row of buttons (Key one) is for single key presses. Press the button with no label and a key to assign that key to the sensor. This is the active key, which will trigger the positive pulse. Click the button and then click outside of the button to deassign the key. The All keys button will hide all other button and send positive pulses on all key presses. This is useful for custom key maps with a Python controller.

The Hold buttons work the same way as the key button but won’t set off a positive pulse unless hold down while the key button is pressed. You can have up to two of hold buttons. If a key is assigned here, a positive pulse won’t be send unless both/all keys are pressed. This is useful if you wish to have for example CtrlR or ⇧ ShiftAltEsc to do a specific action.

LogToggle field assigns a Bool property which determines if the keystroke will be logged in the String property (true) or not (false). This needs to be here if you wish to log your keystrokes.

Target is the String property to which the keystrokes are saved. Together with a Property sensor this can be used for example to enter passwords.

GameLogic python API.

Mouse sensor

The Mouse sensor is for detecting mouse input. The controller consist only of a list of types of mouse events. These are:

  • Left button.
  • Middle button.
  • Right button
  • Wheel Up, the scroll wheel of the mouse.
  • Wheel Down, the scroll wheel of the mouse.
  • Movement, any movement with the mouse.
  • Mouse over, detects if the mouse is over the object.
  • Mouse over any, detects if the mouse is over any object.

There is no logic brick for specific mouse movement and reactions (such as first person camera), these has to be coded in python.

GameLogic python API.

Sensor Touch

Sensor Touch

El sensor Touch envía un pulso positivo cuando el objeto está en contacto con otro objeto. El campo MA está para filtrar materiales. Solo el contacto con el material en dicho campo generará un pulso positivo. Dejar vacío para el contacto con cualquier objeto. El pulso positivo es enviado cuando hay colisión y el negativo una vez los objectos ya no están en contacto. Para un pulso continuo mientras están en contacto use "True Pulse triggering".

GameLogic python API.

Sensor Collision "Colisión"

El sensor Collision funciona como el sensor Touch pero tambien puede filtrar una propiedad. Solo los objetos con la propiedad indicada generaran un pulso positivo cuando haya colisión. Dejar vacío para una colisión con cualquier objeto. A Collision sensor works like a Touch sensor but can also filter by property. Only objects with the property with that name will generate a positive pulse upon collision. Leave blank for collision with any object.

El botón Pulse ... The Pulse button makes it sensible to other collisions even if it is still in touch with the object that triggered the last positive pulse.

El ... The M/P button toggles between material and property filtering.

Near sensor

A Near sensor detects objects that are within a specific distance of themselves. It can filter objects with properties, like the Collision sensor.

Distance is the number of blender units it will detect objects within. Reset is the distance the object needs to be to reset the sensor (send a negative pulse).

GameLogic python API.

Radar sensor

A Radar sensor works much like a Near sensor, but only within an angle from an axis, forming an invisible cone with the top in the objects’ centre and base at a distance on an axis. It has a property filter field (Prop). Next to it is the axis menu, which determines the direction of the radar cone. The ± signs is whether it is on the axis direction (+), or the opposite (-).

Angle determines the width of the cone, and Distance its length.

This sensor is useful for giving bots sight only in front of them, for example. Note that it does see through other objects.

GameLogic python API.

Property sensor

The Property sensor detect changes in the objects properties. This sensor has four modes:

  • Equal triggers a positive pulse when the property value matches the value in the sensor. The Prop field is for the name of the property, and Value is for the value it has to match to send a positive pulse.
  • Not Equal triggers a positive pulse when the property value differs from the value in the sensor. The same fields as Equal, but Value represents the value the property has to differ from in order to set off a pulse.
  • Interval triggers a positive pulse when the value of the property is between the Min and Max values of the sensor. For “more than”, enter the property name in the Max field and the lowest number for triggering in the Min field. For “less than”, enter the property name in the Min field and the maximum value in the Max field. Names of other properties can also be entered to compare properties.
  • Changed sends a positive pulse as soon as the property value changes.

GameLogic python API.

Random sensor

The Random sensor generates random pulses. It has a Seed field to enter the initial seed. 0 is not random, for testing and debugging purposes.

GameLogic python API.

Ray sensor

The Ray sensor shoots a ray in the direction of an axis and sends a positive pulse once it hits something. It can be filtered to only detect objects with a given material or property.

It shares a lot of buttons and fields with Radar sensor. The X button make it x-ray, it sees through objects that doesn’t have the property or material specified in the filter field.

GameLogic python API.

Message sensor

Messages can be used to send either text or property values. The Message sensor sends a positive pulse once a message is sent anywhere in the engine. It can filter to only send a pulse upon a message with a specific subject.

GameLogic python API.

Joystick sensor

The Joystick sensor detect joystick events.

GameLogic python API.

Actuator sensor

The Actuator sensor is set off when an actuator with the name specified in the Act field is activated.

GameLogic python API.