Posts: 1
Threads: 1
%%TYL_NUMTHANKEDLIKED%%
Joined: Apr 2016
Reputation:
0
I have a OBJ model that has five nodes (a vehicle with four wheels). I would like to rotate the wheels according to the velocity of the vehicle. Is there a way with the PowerToys to access these transforms or it's only the global transform that is available?
Thank you
Posts: 562
Threads: 8
%%TYL_NUMTHANKEDLIKED%%
Joined: Sep 2009
Reputation:
4
OBJ files do not support model transformations. Therefore your model (and its sub-parts) were loaded without any transformation.
But all WPF 3D objects have a Transform property that you can use to animate your object.
For example if you have the following structure:
Model3DGroup:
1x GeometryModel3D ("CarBody")
4x GeometryModel3D ("CarWheels")
You can set TranslateTransform3D to the Model3DGroup's Transform to move the car.
You can set RotateTransform3D to wheels GeometryModel3D to rotate the wheels - you can use the AxisAngleRotation3D object for rotation - it takes a rotation axis and an angle.
Note that if your OBJ file sets names for models, you can get the objects by names with using the ReaderObj's NamedObjects dictionary (Dictionary<string, Model3D>) - for example:
var objImporter = new Ab3d.ReaderObj();
var wpf3DModel = objImporter.ReadModel3D("fileName.obj");
var leftWheel = objImporter.NamedObjects["LeftWheel"] as GeometryModel3D;
Andrej Benedik