Creature class in Global context

The object inside the simulated world, including its physical structure, neural network and performance data. Food pieces, obstacles and other movable objects can be implemented as Creatures even though the are not "alive". See also: Population.

65 members:

integer bodysim
integer, 0 .. 1 (false/true)
default=1

Body simulation

(Physical) body simulation can be disabled for individual objects which makes them immovable. Disabled objects can still participate in collisions depending on their collisions masks.

Bugs: the standard collision handler does not work for disabled objects when ODE simulation is used. It means that these objects won't physically interact with other objects. The custom (scripting) handlers work as expected.

integer buildproblems
integer

Build problems

float c_velocity
float

Velocity

float c_vertpos
float

Vertical position

float c_vertvelocity
float

Vertical velocity

float center_x
float

center.x

Center of gravity

float center_y
float

center.y

Center of gravity

float center_z
float

center.z

Center of gravity

float distance
float

Distance

object drive

Enforce constant speed

float energ0
float

Starting energy

float energy
float

Energy

float energy_b
float

Energy balance

float energy_m
float

Energy costs

float energy_p
float

Energy income

object geno

genotype

Source genotype for this creature

string genotype
multiline string

Genotype

integer gnum
integer

Generation

field group
untyped

group

float idleen
float

Idle power consumption

integer index
integer

Index

Index of this Creature in its Population.

string info
multiline string

Info

Additional info or comments

integer lifespan
integer

Life span

object liveModel

current model

A Model object that is a copy of the current (temporary) geometry of this creature

object localDrive

Enforce constant speed (in local coordinates)

object model

source model

Source Model for this creature

string name
string

Name

integer nnenabled
integer, 0 .. 1 (false/true)

NN enabled

integer numjoints
integer

number of joints

integer numneurons
integer

number of neurons

integer numparts
integer

number of parts

object orient

orientation

by convention the creature orientation is equal to its first part orientation

integer othermask
integer, 0 .. 2147483647
default=0

Collision mask (other)

integer perf
integer, 0 .. 2
  • 0 = Off
  • 1 = On
  • 2 = Waiting for stabilization
  • Performance calculation

    Initial value of this property is taken from Population.enableperf

    float pos_x
    float

    position.x

    (pos_x,pos_y,pos_z) is the point of minimal coordinates ("bottom left corner") of the creature, including imaginary Part sizes (Part.s, usually 1.0). See also: Creature.moveAbs

    float pos_y
    float

    position.y

    See Creature.pos_x

    float pos_z
    float

    position.z

    See Creature.pos_x

    integer selfcol
    integer, 0 .. 1 (false/true)

    Self-collisions

    Enable/disable detection of self-collisions (within a creature body). They can only occur when using the ODE simulation engine. If enabled, the creature will have its sticks collide during lifespan.

    integer selfcolstate
    integer, 0 .. 1 (false/true)

    Self-collisions

    Current self-collision state

    integer selfmask
    integer, 0 .. 2147483647
    default=0

    Collision mask (self)

    object signals

    Signal sources

    float size_x
    float

    bounding box x size

    (size_x,size_y,size_z) are dimensions of the axis-aligned bounding box of the creature, including the imaginary part sizes (Part.s, usually 1.0). A creature consisting of a single default part has the size of (2.0,2.0,2.0) - twice the Part.s value (like a sphere diameter is twice its radius).
    See also: Creature.moveAbs

    float size_y
    float

    bounding box y size

    See Creature.size_x

    float size_z
    float

    bounding box z size

    See Creature.size_x

    string uid
    string

    #

    field user1
    untyped

    User field 1

    field user2
    untyped

    User field 2

    field user3
    untyped

    User field 3

    float velocity
    float

    Avg. velocity

    float vertpos
    float

    Avg. vertical position

    float vertvel
    float

    Avg. vertical velocity

    function currentGeometryAsF0
    returns string

    currentGeometryAsF0

    function currentGeometryAsF0()
    function getJoint
    returns Joint

    getJoint (static Model information)

    function getJoint(integer index)
    function getMechJoint
    returns MechJoint

    getMechJoint (current properties)

    function getMechJoint(integer index)
    function getMechPart
    returns MechPart

    getMechPart (current properties)

    function getMechPart(integer index)
    function getNeuro
    returns Neuro

    getNeuro

    function getNeuro(integer index)
    function getNeuroDef
    returns NeuroDef

    getNeuroDef

    function getNeuroDef(integer index)
    function getPart
    returns Part

    getPart (static Model information)

    function getPart(integer index)
    function localToWorld
    returns XYZ

    return world coordinates

    function localToWorld(float x, float y, float z)
    function move
    doesn't return a value

    move

    function move(float x, float y, float z)

    Shift the creature by a given vector.

    function moveAbs
    doesn't return a value

    move to absolute location

    function moveAbs(float x, float y, float z)

    Moves the creature so that its origin (pos_x,pos_y,pos_z) is placed at the given location. The origin is the point of minimal coordinates ("bottom left corner"), including imaginary part sizes (Part.s, usually 1.0).
    Assuming a simple single-stick creature "X" having parts at (0,0,0) and (1,0,0),

    origin (pos_x,pos_y,pos_z) = (-1,-1,-1)
    size (size_x,size_y,size_z) = (2,1,1)

    The following example places the bottom of a creature at a given location (x,y,z):
    Creature.moveAbs(x-(Creature.size_x/2),y-(Creature.size_y/2),z-1.0)
    (assuming that the part size is 1.0)

    function moveLocal
    doesn't return a value

    move in local coordinates

    function moveLocal(float x, float y, float z)
    function rotate
    doesn't return a value

    rotate

    function rotate(float x, float y, float z)

    Rotate the creature around X, Y and Z axes. Should only be used immediately after creating a new creature (before the first simulation step is performed for this creature), otherwise the further simulation could be disturbed.

    function rotateLocal
    doesn't return a value

    rotate in local coordinates

    function rotateLocal(float x, float y, float z)

    Rotate the creature around (local) X, Y and Z axes. Should only be used immediately after creating a new creature (before the first simulation step is performed for this creature), otherwise the further simulation could be disturbed.

    function worldToLocal
    returns XYZ

    return local coordinates

    function worldToLocal(float x, float y, float z)

    Global context