Customize axis system for obj format

Specifying Axis System for OBJ Files in Aspose.3D

Here’s how you can manually set the axis system when working with OBJ files in Aspose.3D:

//construct a right-handed axis system with +y as up and -z as front
Axis up = Axis.YAxis;
Axis front = Axis.NegativeZAxis;
AxisSystem axisSystem = new AxisSystem(CoordinateSystem.RightHanded, up, front);

ObjSaveOptions opt = new ObjSaveOptions();
//use the custom axis system to flip coordinate
opt.AxisSystem = axisSystem;
//set this to true, will convert mesh's position/normal from source axis system to custom axis system
//source axis system is defined by scene.AssetInfo.CoordinateSystem, scene.AssetInfo.UpVector, scene.AssetInfo.FrontVector
opt.FlipCoordinateSystem = true;

 // initialize a new 3D scene from existing file

var scene = Scene.FromFile("input.dae");

// Save the scene with customized axis system
s.Save("output.obj", opt);

By using Aspose.3D’s axis system configuration for OBJ files, you can achieve consistent and accurate import results regardless of the original coordinate system used in the OBJ file. This feature enhances flexibility and control, making it easier to integrate and work with OBJ files in diverse 3D workflows.

Resources

  1. Online Tutorial
  2. AxisSystem