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"

Rotating an object relative to the First Person Camera

So I'm trying to set up this prototype and I'm just having a doosie of a time getting this rotating mechanic working. The idea is that I want to be able to pick up a physics object using a physics handle (works just fine), then the player should be able to rotate the object while holding it. I'm pulling the player's transform and composing it with a transform built from an "Object added rotation" rotator. Basically the idea is that when the player adds scrolls the mouse wheel it adds or subtracts from the pitch (depending on which way the wheel is scrolled, E and Q control the yaw, and R and F control the roll. This data is all stored in the "object added rotation" variable.

The problem is I want the pitch yaw and roll to always be relative to the camera. Scrolling the mouse wheel forward should always tumble the held object forward, away from the camera. The F key should always rotate the object clockwise facing he camera. However, Even when the setting the objects world rotation, pitch and roll get switched depending on the position of the yaw. Could someone give this a look and see where I'm going wrong? I hope my explanation was clear.

Input alt text

Set Rotation Variable alt text

Set Held Object Rotation alt text

-Thanks

Product Version: UE 4.14
Tags:
inputs.png (71.9 kB)
set rotation.png (120.8 kB)
more ▼

asked Jan 01 '17 at 09:50 PM in Blueprint Scripting

avatar image

LordTorsten85
43 5 7 15

avatar image eNDiKay Mar 22 '17 at 08:58 AM

Sadly I'm having the same problem. Followed this tutorial but I don't think they solved it either, they simply never showed it not working: https://www.youtube.com/watch?v=Scb4jhpo9L8

For me when I input stuff on the Y axis the object always spins the same direction, according to the worlds Y axis, no matter if I use world/relative/actor rotation.alt text

unreal_rotate.png (255.4 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

I solved my issue by getting the right vector from the Z axis on the player camera and then using that and the input from my mouse to make a rotator and combine it with the current rotation. Worked for my setup, let me know what happens with yours!alt text

more ▼

answered Mar 22 '17 at 10:19 AM

avatar image

eNDiKay
1 1

avatar image eNDiKay Mar 22 '17 at 10:20 AM

This is the tutorial I based my function on btw: https://www.youtube.com/watch?v=9NorW2C4wRc

(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