Jump to content

[SOLVED] export animation spline from 3DS MAX


photo

Recommended Posts

Does anybody know from where does animation spline takes its coordinates?

After I place the spline in editor and start animation it changes its coordinates. The animation is a platform moving up and down. Only Z coordinates change. No changes in X,Y axis. The animated object was placed in 0 coordinates in MAX and this is where animation starts. In editor I place world transform object with my spline in 0 coordinates of its parent. When I hit play animation the spline (and world transform with attached mesh) move fare away by X, Y.

Why?

Link to comment

Why?

 

Most probably because your exported spline frames include X,Y offset data. You should post your *.spline data file.

  • Like 1
Link to comment

Load following spline.cpp/.world as spline-world, invoke console and look out for non-0 spline X/Y data via new console command "dumpSpline <your filename>". You can than patch your spline file to required (0,0,Z) format by console command "patchSpline <your filename>.

 

This does not solve a potential spline export issue, but at least might be a temporary work-around for you. I will take a look on monday.

 

spline.cpp

#include <core/unigine.h>
#include <core/scripts/system.h>

int init() {

  engine.console.addCommand("dumpSpline", "dumpSpline <filename>  dump spline file position data", "dumpSpline");
  engine.console.addCommand("patchSpline", "patchSpline <filename>  patch spline file position data to (0,0,Z)", "patchSpline");

  return 1;
}

int shutdown() { return 1; }
int update()   { return 1; }


void dumpSpline( string filename )
{
  WorldTransform transform = new WorldTransform(filename);

  for( int i=0; i<transform.getNumFrames(); i++ )
  {
vec3 pos = transform.getFramePosition(i);

log.message("Frame %d   X=%f, Y=%f, Z=%f\n", i, pos.x, pos.y, pos.z);
  }

  delete transform;	
}

void patchSpline( string filename )
{
  WorldTransform transform = new WorldTransform(filename);

  for( int i=0; i<transform.getNumFrames(); i++ )
  {
       vec3 pos = transform.getFramePosition(i);

       pos.x = 0.0f;
       pos.y = 0.0f;

transform.setFramePosition(i, pos);
  }

  transform.save(filename);

  log.message("Patched %d frames\n", transform.getNumFrames() );

  delete transform;	
}

 

spline.world

<?xml version="1.0" encoding="utf-8"?>
<world version="1.12"/>

  • Like 1
Link to comment

Thank you for quick reply. It would be great if you could help. I attached the file in .zip archive because this site did not allow me to upload .spline file type.

 

Hi chromebird, as expected your spline data contains a constant x-y-offset of [-79.448, 312.688]. Exporting some animation splines for object at 0/0/0 from 3DSmax 2010 works for me without any issue. Maybe you should try to do a spline re-export. If you still encounter the problem, than feel free to post your 3DS max scene for further investigation.

 

post-82-0-23999100-1305566145_thumb.jpg

  • Like 1
Link to comment
  • 2 weeks later...

I was away from work last week. I tried to re-export the spline yesterday and it turned out fine. Your test helped me to localize the problem. The x-y-offset was the same with the previous x-y coordinates in Max scene. I guess the problem appeared because I did not reset object's transforms. Animation played well in Max but at export the spline took old coordinates of the object relatively to the center of the scene. I deleted all animation keys, applied ResetXForm modifier, animated the object and exported as a spline again. This time the spline's position was correct. Thank you very much for your help.

Link to comment
×
×
  • Create New...