What is the logic behind this?

Copy-coding is getting the job done but what is the logic behind this? How does this work? How does getactorrotation helps us behind the code?

Are you saying that you don’t know why anyone has a need to get the actor’s location?

UE4 makes many things available so that when you need to do something you can quickly use what they give instead of writing that code yourself. So if you need to know the location in this instance, you can get it.

You can do all kinds of things with locations right. For example, you can’t use a map if you don’t know your location. People can’t say hi to you in person if they don’t know your location. So on.

So you get location from that and you can use it for whatever you come up with.

Thank you but that was not the question i was asking. I know it’s a function and you can use it anywhere you need it. What i’m trying to ask is why did we use it in this specific scenario? How getting actor’s location and combining it with mouse axis input fixes yawing platform? What is the math logic behind it? I mean sure we can all go ahead and copy what we see as the teacher says “We add this and we add that and we call this function and ta-da; it’s working!” but i believe there is a big difference between what a code does and how it does it.
Edit: getactorrotation not getactorlocation. My bad.

1 Like

Ah. That’s definitely making more sense now :slightly_smiling_face:

I will let someone else comment more specifically on the corrected version with the context as the code in use as I would make this too long.

But, my short answer is just don’t use it and try playing. That should help you to understand why.

The question then becomes why not some other way? API perhaps is the short answer there.

Often its just personal opinion as to what to use when there are multiple ways or something is just more specifically tuned to a specific way even though multiple ways can work.

Its really up to you if you want to use it. There’s no rule that says you must but you then must deal with the new result as a result of that action.

1 Like

Thank you for your reply. I like your point of view. Actually i managed to make it work with mouse even without watching that. It was a mess of a code but it worked and i felt good for solving it my own but i’m a little thick headed when it comes to math :grinning:. Always digging for “how” is good thing i guess. Here is my own primitive mouse axis solution https://blueprintue.com/blueprint/9o331xjb/

1 Like

I believe this is explained in one of the lectures but I’ll write it down here as well.

The reason we’re using GetActorRotation and adding the axis values manually is that we want to filter out any “noise” when adding rotators together. This makes sense cause we always want the Z-Axis to be 0 for this project, and adding rotators together without any additional processing will always produce some additional “noise” in axis we don’t want.

It’s similar to why gimbles used for Video Cameras have multiple joints that only rotate in a certain axis. And you can technically create a system like that in UE for the Maze as well, but that goes beyond the scope of this answer.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.