x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

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. alt text 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... alt text

Product Version: UE 4.21
Tags:
mysetup.png (507.3 kB)
more ▼

asked Nov 16 '18 at 12:49 AM in Blueprint Scripting

avatar image

PotatobobZfragD
11 1 3

avatar image PotatobobZfragD Nov 16 '18 at 11:47 PM

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... alt text alt text alt text

1.png (95.8 kB)
2.png (199.8 kB)
3.png (91.0 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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. alt text

final-code.png (368.2 kB)
more ▼

answered Nov 17 '18 at 04:51 AM

avatar image

PotatobobZfragD
11 1 3

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question