luffy
July 24, 2023, 9:20am
1
hi all,
i want to export .skp model to unreal engine. everything is ok, but i can’t get the correct world transform for the componentinstance or group. when i use the SUComponentInstanceGetTransform, it return the relative transform. is there any way to get the instance/group world transform? or has the interface like: SUComponentInstanceGetWorldTransform?
You will need to combine the transformations as you dig down into the model hierarchy using:
The model level entities would have an identity transformation.
@tt_su Does the C API define a constant for IDENTITY
? (I cannot find it in the documentation.)
ANSWER : No . Not yet. I proposed a new constants file for the C API almost 4 years ago , see:
opened 07:29AM - 17 Oct 19 UTC
enhancement
C API
SketchUp
LayOut
### SketchUp & LayOut C API Parity Feature Request
#### The Ruby API has pred… efined Geometric helper objects referenced by constants ...
```ruby
# Ruby API used for SketchUp models ...
ORIGIN # a Point3d
X_AXIS # a Vector3d
Y_AXIS # a Vector3d
Z_AXIS # a Vector3d
IDENTITY # a (3D) identity transformation
# Ruby API used for LayOut documents ...
ORIGIN_2D # a Point2d
X_AXIS_2D # a Vector2d
Y_AXIS_2D # a Vector2d
IDENTITY_2D # an identity Transformation2d
```
#### ... these are not yet defined in the C APIs.
```c
// Geometry Constants : "geometry_constants.h"
// Should (in the future) be included by: "geometry.h"
#ifndef GEOMETRY_CONSTANTS_H_
#define GEOMETRY_CONSTANTS_H_
// SKETCHUP
const struct SUPoint3D SU_ORIGIN = { 0.0, 0.0, 0.0 };
const struct SUVector3D SU_X_AXIS = { 1.0, 0.0, 0.0 };
const struct SUVector3D SU_Y_AXIS = { 0.0, 1.0, 0.0 };
const struct SUVector3D SU_Z_AXIS = { 0.0, 0.0, 1.0 };
const struct SUTransformation SU_IDENTITY = {
1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0
};
// LAYOUT
const struct SUPoint2D LO_ORIGIN = { 0.0, 0.0 };
const struct SUVector2D LO_X_AXIS = { 1.0, 0.0 };
const struct SUVector2D LO_Y_AXIS = { 0.0, 1.0 };
const struct SUTransformation2D LO_IDENTITY = {
1.0, 0.0, 0.0,
0.0, 1.0, 0.0
};
#endif // GEOMETRY_CONSTANTS_H_
```
luffy
July 26, 2023, 2:48am
4
thanks for the reply.
i have tried to dig the hierarchy, but the result seems not correct. the model hierarchy like this:
if the method is wrong, how can i dig/get the correct model hierarchy?
There is an example of walking the model hierarchy in the SDK “sample” folder.