# Custom Rotation for a tilted aircraft flap

I've been modeling an F-15, but when I rotate the flaps on Y-Axis the Flaps offset from the wing and they look like they are about to fall out, so I end up correcting it by rotating in the X and Z-axis to align them correctly.

However when I rotate them back from the Y-Axis they look distorted again because I did rotations on the X and Z axis. I tried riding it, no help. I saw something about custom orientation to fix it but that was not clearly explained and it was done on an ideal plane that was (0,0,0); mine is pre-rotated on all axis.

I'll take scripts if needed and I'm using Blender 2.8.

When I rotate it on the Y-Axis:

Fixing it using X and Z rotation:

Rotating it back on the Y distorted it again:

Here's the wing with ailerons and flaps:

• have you parented them to bones? there should not be any difficulty – moonboots May 15 at 7:43
• Yes I did, the same thing happens when I rotate the bone on Y – Reuben X May 15 at 7:45
• Could you please share just a wing so that we try on it? – moonboots May 15 at 7:49
• Just did it. You can download just the wings now. – Reuben X May 15 at 8:31

If you do it this way it seems to work:

• Create a bone, in the Properties panel > Data > Display, enable X-Ray (called In Front in 2.8).
• Put the bone along the aileron's axis. Use the shiftS > Cursor To Selected and the shiftS > Selection To Cursor to make sure the head and tail of the bone are on the exact positions.
• If you want the bone to be displayed as B-Bone, go in the Properties panel > Data > Display (altctrlS to change its thickness).
• Parent the aileron to the bone With Automatic Weight.
• Select the bone, switch to Pose mode, create a first keyframe with i > RotLocScale.
• In the Dopesheet go to frame 20, rotate the bone on its Y axis with RYY. Create a second keyframe.
• The bone should make the aileron rotate correctly. You'll have to parent the bone to the wing bone (or whatever bone that will make the aileron stick to the plane).

Axis angle rotation.

Euler rotation lets us set a rotation based on local axes and an order. One of the flaps is pretty much y axis aligned and hence euler y rotation could be used. Note: really pays to set up parenting, eg flaps to empty, empty to wing. Align the empty such that an axis coincides with that of a flap.

However that little used other rotation type, Axis Angle enables you to set the axis of the rotation. The object will rotate on that axis direction passing through its origin.

A little helper script, since your objects have no rotation, can select an edge, that is parallel to axis of rotation, in edit mode and set the rotation axis from it. (as well as the mode to angle axis)

import bpy
from mathutils import Vector
import bmesh

context = bpy.context
ob = context.edit_object
me = ob.data
bm = bmesh.from_edit_mesh(me)

e = bm.select_history.active
if e and isinstance(e, bmesh.types.BMEdge):
v = (e.verts[1].co - e.verts[0].co).normalized()
ob.rotation_mode = 'AXIS_ANGLE'
ob.rotation_axis_angle = 0, v.x, v.y, v.z


Once the axis is set, only the angle need be adjusted.

• This helps a lot but I need precision and there aren't many edges that are exactly on the axis of rotation I want for the elevators and slats and rudders. But thanks – Reuben X May 15 at 15:51
• but, but, but they only need to be parallel to axis of rotation. The values can be taken from 3d cursor, or vertex locations to create axis vector. It would be the same precision as positioning a bone for instance. – batFINGER May 15 at 15:52
• How about extendability, rigging the aircraft will make it easy to animate. But your way is perfect for making a still poses. – Reuben X May 18 at 4:52