Need help coding DC

I need a function to keep an object always facing up on the Z axis, so that when the component is rotated on the X and Y axis, this object, inside the component, remains in the same position.

this code is in Roty of object:

Why not just negate the parent’s rotation ?

rotx: =parent!rotx*-1
roty: =parent!roty*-1

this doesn’t work, any correction that works by correcting the rotation of the Y axis while the DC is in the home position works, but when I rotate the DC on the Z axis and try to rotate the Y axis (which is now facing the X) everything stops work.

I will make a more detailed video

this is the file i’m working on
Cx4x2-2.0.skp (130.1 KB)

The rotational interaction between the native code and the DC is not intuitive. The various rotations can all change when one value is changed. A complication of pitch, roll, and yaw

3D Rotation Matrix to Euler Angle - Bing images

However I know you can isolate the effects by adding an extra nesting and not reference the parents rotations

I suggest, rather than trying to auto this, that you create the DC to react to a option or onclick

The attached file has a basic DC, that change to onclick, all with same uniqueness change.

point symbols example.skp (45.4 KB)

1 Like

now I understand the complexity of the thing kkk I was inspired by the tip to solve the issue, thank you all for your help.

I’ll leave a video showing how it turned out