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"

AnswerHub Maintenance

Background maintenance is scheduled to occur between 9 - 11am EDT on Tuesday, May 21. Site operation may be slower than normal during this time and a brief interruption in operation may be observed

Simple rotation in blueprints. ( Rotators and range? )

Hi,

I'm trying to rotate an object about a point. I have the idea of how in my head but I'm running in to some issues with the actual math involved. Now I don't know too much about vector math, or quaternions, specifically rotations and things like gimble.

Now everything is functioning as I want it too except that I have a problem when I hit 90( for example on the Y axis ) on my rotation. When I do that it starts to jitter slightly and it tries to stick at a value of 90. I can modulo that back to 0 so it doesn't freak out. But of course when doing that the object moves back too, essentially, it's start point and the rotation starts over. This only gives me 45 degrees of rotation. So I have two questions.

1: Why is this happening? Is this the gimble lock thing? If I understand why it's occurring then hopefully I can avoid it in future.

2: How can I rotate the full 360 degree's on any given axis?

Here's a snapshot of what I'm currently doing:

alt text

Here's how I'm setting the rotator. I've also tried world rotation and it's the same result.

alt text

Thanks,

Geoff

Product Version: UE 4.18 Preview
Tags:
more ▼

asked Oct 05 '17 at 05:33 PM in Blueprint Scripting

avatar image

xuri
1 2 1

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

4 answers: sort voted first

See my tutorial I posted on blueprints it covers simple rotation.

more ▼

answered Oct 05 '17 at 05:41 PM

avatar image

Chaven
31 4 4

avatar image xuri Oct 05 '17 at 05:48 PM

Do you mean this? https://answers.unrealengine.com/storage/attachments/215801-introduction-to-unreal-engine-blueprints-for-begin.pdf

If so I just skipped through using rotation as a keyword and you mention placing a limit on it.

Shouldn’t we place a restriction on the upper limit of the yaw value as a float goes up to 3.4x10^38

Could you elaborate on that a bit please?

Thanks,

Geoff

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

If youve done coding bedore then you will know that there are limits on data types like floats and integers etc. We adding 30 to our float variable each frame. Its bound to exceed this limit and will cause an error at some stage.

more ▼

answered Oct 06 '17 at 07:47 AM

avatar image

Chaven
31 4 4

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

Of course. I think you're misunderstanding my problem. It hit's 90 and then stays there, it doesn't advance any further. A float can hold a value higher than 90. I'm not pushing the type past it's limitation.

Basically I want to do this every frame:

Y + (RotationAmount * Delta) = NewY.

Then of course handle the case when it reaches 360 to wrap it back around to 0. I'm not exceeding the data type.

more ▼

answered Oct 06 '17 at 01:23 PM

avatar image

xuri
1 2 1

avatar image xuri Oct 06 '17 at 01:48 PM

If I just start with a float at 0 and increase from there it works. It only seems to get weird if I first fill the variable using GetWorldRotation. I'm obviously misunderstanding something with that.

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

The problem is in your modulo 90.

Think about modulo as "evenly divide by this number, and give me the left over part". If you modulo 100 by 90, you get 10, because you divide out one 90 and you have 10 left over. If you modulo 80 by 90, you end up with 80, because you divide out zero 90s, and you're left with 80. If you modulo 100 degrees by 90, you end up with 10 degrees. That's why this math looks ok under 90 degrees, but gets weird above 90.

It sounds like what you're actually intending to do is round down to the nearest degree or something? I'm not really sure what the jitter you're describing is, but modulo isn't the solution. :)

Rotations like this normally don't "jitter", so you should figure out what's wrong with your object rotations that are causing it to jitter.

more ▼

answered Oct 07 '17 at 01:33 AM

avatar image

Ecnassianer
151 4 10 11

(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