As the picture shows, I wish to press a button when I am flying the plane. I'm writing the program in DirectX 12 and C++, without a game engine. I am new to this, so I don't know which approach to use to simulate the button press. Should I use a skeleton and make an animation binding to the bone, or just program the button position in code?
3 Answers
Skeletal animation is great for organic 3d models, because skeletal animation systems can simulate squeezing and stretching of parts of the 3d mesh. This means that when a joint of a living being moves, the skin and cloth doesn't retract into the body, it stretches just like it would for a real being.
But for objects which are supposed to look mechanical, skeletal animation is usually overkill and/or doesn't give you the effect you want it to have. I would recommend you to make each button/switch/knob an own 3d object and implement the animations by simply translating/rotating them.
If you later would like to add a pilot's hand which presses the buttons, it might be worth thinking about implementing a skeletal animation system for it.

- 119,250
- 27
- 256
- 336
-
Skeletal animation works fine for mechanical objects as long as your bones allow arbitrary transformations (such as translation). – user253751 Jan 10 '18 at 04:19
The simplest solution is to make the buttons independent models.
Merging the meshes and sending the state of individual buttons to the GPU is an optimization to be left for when you need it. When you get to that point, that optimization can take many forms, only one of which is skeletal animation. Another one would be dynamic batching.

- 9,925
- 2
- 31
- 45
There would be unnecessary complexity involved in setting up a skeletal mesh only for this.
All you need to do is set a new position for the various vertices of the button, in code; the easiest way to do this may be to treat the button as a submesh, or a wholly separate mesh, when the flight console is being constructed in e.g. Max, Blender or Maya. You can then shift the origin in code, and all the button's vertices will shift with it.

- 29,455
- 4
- 72
- 120