Rotating specific parts of an OBJ file?

I’m trying to build a pretty basic flight simulator. I’ve got a model of a plane that I built in Blender with different objects for parts of the plane: fuselage, wings, ailerons, elevators, etc. I exported it as a .obj file and I’m able to load and render the entire model using ObjLoader and a TriMesh.

I’m trying to figure out the best way to start modifying the mesh based on the inputs so that the control surfaces rotate in place as the plane maneuvers. A quick (though probably not the most efficient) idea is to export with objects as groups and then load each group into its own mesh and render them all individually. Then I can rotate each piece individually (though I’m not sure how I’ll figure out the proper origin for the rotations) before rendering it.

What’s a better way to do this?

Maybe it is worth to look into some model loading blocks like @ryanbartley’s new gitf or @num3ric’s Cinder-Skinning/ModelSource block or assimp. These are more complex than ObjLoader, but you can access the node graph, so rotating the mesh groups should be easier.

1 Like

Oh very helpful. I’m going to do some investigation on the gltf block since that seems like a nice future proof direction.

GLTF makes sense to me too. FWIW at LucasArts we skinned airplanes, things like rudders and ailerons don’t get moved as individual meshes but as a verts bound to a joint.

There’s other advantages to skinning your plane as well; you can have the wings flex, so that they droop on the runway, and bend upwards in flight, just as real wings do. In a combat sim you can also model damage with skinning.

Yeah I went down the separate objects route since that seemed like the simplest thing with OBJ files. I couldn’t figure out another way to annotate the specific verts that would need to move. Since glTF v1 and Ryan’s code support skeletons and skinning it’s a much more attractive option.