Regular API function


Description Adds a light copy of a shape in its current configuration, as a ghost object. Ghosts have a visual start and end time, and are automatically played back during simulation (i.e. visualized), but they do not influence a simulation otherwise. Ghost are a convenient way to visually compare several simulation runs. Ghosts can be modified or cleared with simModifyGhost. Ghosts can also be cleared in the environment properties.
C synopsis simInt simAddGhost(simInt ghostGroup,simInt objectHandle,simInt options,simFloat startTime,simFloat endTime,const simFloat* color)
C parameters
ghostGroup: an identifier that allows grouping several ghosts
objectHandle: the handle of a shape, or the handle of a model base. Only currently visible shapes can be duplicated as ghosts.
options: bit-coded:
bit0 (1) set=the provided objectHandle is a model base, and all visible shapes in the model will be duplicated as ghosts
bit1 (2) set=the provided start- and end-times will be played-back in real-time
bit2 (4) set=preserve the original colors
bit3 (8) set=force invisible objects to appear too
bit4 (16) set=create an invisible ghost
bit5 (32) set=backface culling for the ghost (only when using custom colors)
startTime: the time at which the ghost should appear.
endTime: the time at which the ghost should disappear.
color: 12 values that represent the color of the ghost (ambient_diffuse RGB, 3 reserved values (set to zero), specular RGB and emissive RGB). Can be NULL for default colors.
C return value
-1 if operation was not successful, otherwise a ghost ID. Several ghosts might share the same ID (e.g. when a ghost was added with bit0 of options set)
Lua synopsis number ghostId=simAddGhost(number ghostGroup,number objectHandle,number options,number startTime,number endTime,table_12 color=nil)
Lua parameters
Same as C-function
Lua return values
Same as C-function

All regular API functions on one page