How to get a Angular Motor current orientation using blueprint?

Hi, I am looking for a way to get the current orientation of a Angular Motor. Thanks in advance for any help!

Basically when looking both in the inspector and in the blueprints I cannot find the current orientation of an angular motor. I need this value as I wish to control a joint and have a copy of this joint somewhere else attempting to reach the same angle every frames.

Ill try to explain a bit more with this picture of my setup.

Ok so both the white-blue and the red-yellow joints are the same except they have different color. Their limits are the same but one will be using the “Target Orientation” variable in order to reflect the the angle of the other.

By example right now the red and yellow joint is controlled by the player as a somewhat ragdoll joint. This joint does not use the angular motor. The white and blue joint though is using the angular motor but needs to know the desired “Target Orientation” in order to use force to attempt to have the same angle as the red and yellow joint.

I did attempt to find the angle by myself like below but the problem here is that I am first really bad with that angle stuff and my calculation seems wrong but the main issue is that I might have to deal with angles greater then 180 degrees. Basically if the angle can be larger then 180 degrees there is no point attempting to calculate it using 3 points method since it will pull out the shorter angle that is less then 180 thus incorrect…

I spent the day attempting to fix this issue to end with a failure, proving me how much I need the current angle orientation.

Here is the code I wrote today in order to find the current angle of a joint and set that value as target orientation on a different actor. This works well as long as you don’t rotate in a different axis…

259643-1.png

After several hours of messing around I realized that my first option was the best I just had to tweak it. Basically no i dont think it is possible to get the current angle as I wanted but we can get really close to it. It’s just overly complicated…

Step1: Set up the pivot the way you want it with limitations but make sure that the angular limits are using a swing limit value below 180 degrees to get accurate reads, this is because there are no way for me to figure when an angle passes over 180 degrees and when this happens it will return 360-yourAngle instead…

Step2: Position the object to rotate along the axis and create a new actor (place it in the hierarchy of the object that will not rotate) and set its location along the axis with the object to rotate but make sure that it’s position reflects the position of the object to rotate when it is in the maximum angle that you desire.

Now jump in the blueprint

Step3: Get the constraint location and the location of the object to rotate to make a direction.

Step4: Make a direction from the constraint location to the new actor that serve only to this purpous

Step5: From those 2 direction we can get the angle that we have been looking for yayyy !!! (remember no value above 180 though)

Step6: Since the Angular Limits have a swing limit to respect but that swing limit is basically 50/100 swing left and 50/100 swing right we need to take this in consideration when calculating our angle.

Step7: You feel like me that this was a sloppy job and you dont feel like testing 20 time by moving the empty actor around well do like me and add an extra variable that you can tweak by example (-40 , -23 , 0 , 50…) and it will help you to get the accuracy missing if there is any!

At this point I almost hope there are no better options as I am just tired of this problem and I am done!
Here is my code, enjoy it and best of luck on your project if you have this issue.

There are nodes called “Get Current Swing 1”, “Get Current Swing 2”, and “Get Current Twist” that you can get the angles of physics constraints.

However, you can’t call these nodes from physics constraints in a skeletal mesh, for that you need “Get Delta Transform From Ref Pose”