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"

Set local rotation

Unfortunately it seems there is no "SetLocalRotation" node, and the only way to rotate an object on it's local axis is to use the "AddLocalRotation" node.

I want an object to match the Z value rotation of another object, but to rotate on it's local axis instead. Niether SetRelativeRotation or SetWorldRotation seem to work this way. Does anyone know of a way to set a local rotation instead of just adding to it?

Product Version: UE 4.15
Tags:
more ▼

asked Apr 23 '17 at 01:07 AM in Blueprint Scripting

avatar image

Gumballcrash
3 2 3 5

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

local space rotations are for components that are attached to other components. if you want to rotate an actor around its up vector, you can use RotatorFromAxisAndAngle. and if you want to set the rotation, instead of adding to it, just skip the getActorRotation/CombineRotators part.

alt text

more ▼

answered Apr 23 '17 at 11:00 AM

avatar image

ScottSpadea
9.6k 320 205 450

avatar image Gumballcrash Apr 23 '17 at 01:14 PM

Thanks for your response! I should have included that the object I want to set rotation on is a component attached to another component.

I attempted it on the component using SetRelativeRotation in place of SetActorRotation and GetUpVector instead of GetActorUpVector. It does follow the rotation of whatever I feed it, but it still doesn't want to rotate on it's local axis.

avatar image ScottSpadea Apr 23 '17 at 01:44 PM

up vector is always a world vector, its not relative, so you should use SetWorldRotation instead of SetRelativeRotation.

alt text

avatar image ScottSpadea Apr 23 '17 at 02:22 PM

and if you just want to set the rotation, instead of adding to it, replace the GetWorldRotation node with a Rotator variable, where you can store the default rotation.

avatar image Gumballcrash Apr 23 '17 at 03:34 PM

That worked!! Thank you so much! You saved me a lot of trial and error. :)

(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