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"

[Bug?] Relative rotation not working as expected

I am trying to rotate a mesh component relatively to the Root component (around the axes of the root) (or in general around any component the mesh is parented to), but the add relative rotation block ist not behaving as i had expected. Some screenshots:

This is my setup:

alt text

When pressing G the rotation works perfectly, even when tilted the mesh component does not rotate around the local z axis, but around the root z axis. But when pressing F the rotation occurs on the local axis.

From the starting position (axes aligned), after pressing G a couple of times:

alt text

Until here everything is going as epected, but pressing F now causes this:

alt text

The mesh has rotated not relatively to the root, but has performed a local rotation around its y axis. Pressing G another couple of times shows that the relative z axis rotation is working correctly:

alt text

What am i doing wrong? Maybe i did not understand the function of the add relative rotation block (which is documented somewhat sparsely)? Maybe i did not understand the difference between the add relative rotation and add local rotation blocks? Is there another block that rotates around the axes of the parent component or do i have to use vector math?

Any advice is appreciated! Thanks

Product Version: UE 4.9
Tags:
setup blueprint.png (208.9 kB)
setup.png (147.6 kB)
rotation 1.png (239.9 kB)
rotation 2.png (186.4 kB)
more ▼

asked Sep 20 '15 at 12:06 PM in Blueprint Scripting

avatar image

Lazarus5000
176 6 4 10

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

You are using the wrong function mate. Instead of AddRelativeLocation you must use AddLocalRotation. They work a bit different. The rotation around the Z-axis is working, because there is no difference between the parents Z-axis and the childs Z-axis. AddRelativeRotation adds rotation taking in consideration the local rotation of the parent. It adds rotation relative to the local space of the parent. AddLocalRotation on the other hand adds rotation relative to the local space of the object being rotated.

AddRelativeLocation

AddLocalRotation

more ▼

answered Jun 16 '16 at 05:50 AM

avatar image

dbrizov
324 21 22 42

(comments are locked)
10|2000 characters needed characters left

Hello Lazarus5000,

The node is functioning properly, as it is adding relative rotation, but never resetting the values, which is why you're getting the rotation occurring based on the child's rotation. For example, you're rotating the child 2 degrees along the z axis, and then rotating it along the Y axis. However, this 2 degree rotation on the z-axis has not been reset, which is why your rotation is behaving as it is. You are correct that the best way to accomplish what you are looking to do would be to use vector math. You'd have to store the parent's initial rotation in a variable, and then add the rotation that you want each time. After you do this, set the relative rotation for the child with this new value and that should work.

Have a great day,

Sean Flint

more ▼

answered Sep 28 '15 at 07:45 PM

avatar image

Sean L ♦♦ STAFF
44k 485 149 438

avatar image Lazarus5000 Sep 29 '15 at 02:17 PM

Hi Flint,

thank you for the answer, but i am afraid i did not describe my problem precisely enough.

I am not trying to reach 2 different rotations depending on which key I press and setting a fixed rotation for each, therefore I do not want to reset the rotation I already perfomed on the child along the z axis, I want to keep the rotation as it is and then rotate around the parent's y axis, and not the child's y axis as it is happening now.

With the current setup the initial rotation around the z axis was just to be able to differentiate between a local rotation of the object around its own y axis and a relative rotation of the component around the parent's y axis (not rotating around the z axis first would not make it possible to see if the component is rotating around the own local axes or relative to the parent's axes)! What i was trying to illustrate is that a relative rotation around the z axis indeed rotates around the z axis of the parent, but a relative rotation around the y axis only rotates around the local y axis of the component, and not the y axis of the parent.

What else is the function of the AddRelativeRotation block, if not adding rotation relatively to the parent's axes oposed to the AddLocalRotation block which applies local rotation around the local axes of the component?

Thanks again and i hope i made my point clear this time. Lazarus5000

avatar image Sean L ♦♦ STAFF Sep 29 '15 at 03:53 PM

Hello Lazarus5000,

What you can try to do is instead of targeting two different components inside of one blueprint, create a child blueprint that uses the same rotation behavior as its parent, and then see if that gives you the results that you're looking for. I look forward to hearing your results.

Have a great day,

Sean Flint

avatar image Lazarus5000 Sep 30 '15 at 08:10 AM

Anyways i managed to solve it now and i am marking your answer as accepted because of the effort and advice that helped me achieve it.

alt text

Thanks again.

blueprint.png (76.0 kB)
(comments are locked)
10|2000 characters needed characters left
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