Jump to content

WorldTransform Manual Construction


photo

Recommended Posts

Hello,

 

How can I manually construct a WorldTransform?

I do not wish to load a spline, rather create a spline.

 

worldTransform = new WorldTransform();

// add frames manually
for(int i = 0; i < intervals; i++){
float x = float(i) * scale / intervals;
float y = sin(x) * scale;
int frame = worldTransform.addFrame();			
worldTransform.setFrameTransform(frame, translate(vec3(x, y, 1)));
}
worldTransform.setFrame(0);
worldTransform.setLoop(1);


//
log.message(string(worldTransform.getTransform(time)) + "\n");
// displays a -1.#IND matrix

 

What am I doing incorrectly?

Link to comment

Quick guess: you must define increasing frame times via WorldTransform::setFrameTime( int frame, float time ) on spline creation. Right now all frames have time value 0.0.

Link to comment

Quick guess: you must define increasing frame times via WorldTransform::setFrameTime( int frame, float time ) on spline creation. Right now all frames have time value 0.0.

 

Thanks Ulf! That fixed the problem.

Link to comment
×
×
  • Create New...