How to rotate an actor not using its axis?

Hello! I’m doing a menu like the one in the video below in my project, but the actors don’t rotate the way I want them to.

I don’t want to use the actor’s axis’ but their relative position to the viewport. There’s a video below for reference, from Resident Evil 3, in which you can see what I mean. No matter the actor’s rotation, it always rotates to the left/right or top/bottom of the screen, not in the rotation relative to the item. Please help I’ve been trying to figure this out for about a week now…

Something like this?

1 Like

Yes! I tried to replicate what you posted there but it doesn’t rotate at all. Here’s what my current code looks like:

This is in the widget:

And this is in parent actor blueprint:

Like I said I tried replicating it but does not work, rotation is always 0.

Also, this is what the actor looks like:

Either query mouse position in the widget or in the controller. Don’t mix both. If you need mouse delta in the widget:


On a somewhat unrelated note:

OnMouseMove executes every frame. Avoid calling it here. Cache the actors elsewhere perhaps?

1 Like

This worked!! Only issue it moves VERY fast lol. How should I speed it down?

And the get all actors thing was the easy way to do so, since only the item that I want to examine gets spawned and then destroyed when that widget closes. Is it still a problem even if that’s how I’ve set it to work?

You could multiply delta by a < 1 factor:

1 Like

Thank you!!! You’ve been so helpful these past few days, I really appreciate it. Would you happen to know how could I use a gamepad to rotate the actor too?

Enhanced Input works well in widgets. I’d use that. It can even spit out a swizzled ready-to-go value.

And the get all actors thing was the easy way to do so, since only the item that I want to examine gets spawned and then destroyed when that widget closes.

I’d probably push a ref to the widget. If can take a performance hit, it’s up to you. Since there’s only one, perhaps this is enough:

image

At least no need need of a loop. Probably irrelevant.

1 Like

I did this and the cube started rotating by itself hahaha

That :point_up_2: is not Enhanced Input, though. This is:

image

Those pins only fire when certain configurable conditions are met.


You could still use the legacy system, you just need to gate it (because it (again) executes every frame)), something close to:

Second option doesn’t seem to work because of this

How should I set the enhanced input? I have not gone further than using triggered, started and completed with those

But you had it working there!


image

image

Triggered fires only when you fiddle with the stick. You can play with axi negation in case you want another direction.

Enhanced input doesn’t work either :face_with_raised_eyebrow: I’ve linked it to a print string but doesn’t fire

Did you add mapping context and all?

Yes! I also added the modifier to the context to try to make it work

In which blueprint and how did you add the mapping context?

This is how it’s added to my TPC

Do I have to add it anywhere else?

And the Input Actions never trigger? Even outside the widgets?

If I place that input action in the character blueprint it triggers infinitely after i’ve moved the left thumbstick, even after I stop

But that’s not how IA works, hm. It only triggers when the input is down. Can you test it with a keyboard key? What are the chances the pad is drifting and keeps sending values?

I have an old thing here and every now and then, when plugged in, it will randomly start rotating the camera, giving me the heebie-jeebies.