Displacement Map Object Agents

Flags

LOCAL
WORLD (READ-ONLY)
An optional flags() function in your Displacement map lscript can return two values, either LOCAL or WORLD, depending on which coordinate system you wish your lscript to use. By default this is assumed to be WORLD unless stated otherwise.

flags
{
return(WORLD);// sets the coordinate system to WORLD explicitly.
}

PREBONE

Allows for displacement to be done before bones.

flags
{
return(PREBONE);
}

Data Members

point The Displacement Access Object Agent, provided to the process() function of Displacement LScripts, now exports a point data member. This data member holds a Point Object Agent for the mesh point currently being processed.

oPos[3] (READ-ONLY)
oPos[3]are numbers representing the position of the point being processed at its origin. These values do not change, and should be used to calculate offsets based on the passage of time.

source[3]
source[3] are numbers representing the new position of the point being processed for the current frame/time.

Methods

No methods are provided by a Displacement Object Agent.

Example:
The LazyPoints.ls example will use a Displacement Map Class script to demonstrate how to use the Displacement Map Object Agent.

//-----------------------------------------------
// LazyPoints LS                                                      
//
//
//

@version 2.3

// Setup the global variables.
curFrame,curTime,curId;
lagRate = .25;

newtime: id, frame, time
{

     //Update the global variables.
  curFrame = frame;
  curTime = time;
  if(!curId) curId = id;
}

process: da
{
  // Using the da Object Agent, get the original
  // position of the point (minus the pivot point).
  original = <da.oPos[1],da.oPos[2],da.oPos[3]> -
curId.getPivot(curTime);

     // Compute the lagtime.
  lagTime = curTime - lagRate * vmag(original);

     // Gather motion information.
  xax = curId.getRight(lagTime);
  yax = curId.getUp(lagTime);
  zax = curId.getForward(lagTime);
  pos = curId.getWorldPosition(lagTime);

     // Using the da Object Agent, set the new position(s)
  // of the point.
  da.source[1] = pos.x + original.x * xax.x + original.y *
yax.x + original.z * zax.x;
  da.source[2] = pos.y + original.x * xax.y + original.y *
yax.y + original.z * zax.y;
  da.source[3] = pos.z + original.x * xax.z + original.y *
yax.z + original.z * zax.z;
}

options
{
  // Create a simple interface.
  reqbegin("LazyPoints LS");
       c1 = ctlnumber("Lag Rate (sec/meter)",lagRate);
       return if !reqpost();
       lagRate = c1.value;
  reqend();
}