Hello fellow UE fam! I am trying to make a basic Character Pane that has the player character as a 2D Scene Capture material. I’ve managed to do that by spawning the Overlay actor somewhere in the world but I want the player to be able to rotate the rendered version of it from the UI. Basically, this is what I have:
I also messed around with Drag and Drop but I’m not sure if that’s where I should handle this logic from. Currently I have something like this which allows me to rotate the spawned actor, therefore rotating the 2d capture version of it as well inside the UI: (excuse the mess, I haven’t slept for days)
However it does not work as intended. It’s choppy because I believe I should be calling SetWorldRotation somewhere else but not sure where! Here’s what it feels like ingame:
Here I’m spamming left-click while trying to drag/rotate, and this is what I could achieve so far. How would I go about detecting the drag operation and rotate smoothly until MouseButton is up/not pressed? I suck at widgets so the more I learn the better! Appreciate it.
You need to use mouse move to achieve better results:
On mouse down you save current mouse position, set some bool so mouse move function can calculate the change in drag,
Mouse move you Get current mouse position and subtract it from old mouse position
Mouse up you stop mouse move
Here’s a working example I have, in the last image you see I’m using add local rotation to a spring arm so replace the spring arm with a mesh or whatever you want to rotate.
Hi, can you help me, I’m trying to do the same thing, but I haven’t been successful yet, just let me see if I understand the solution that our friend posted here. The On mouse button up, On mouse button down and on mouse move functions are overrides, right? they are located in the blueprint widget that contains the image of the material, while the set mesh rotation function is created in the actor that has the 2d scene capture component. I literally did everything right but when trying to rotate it, it doesn’t rotate and I get an error that it was not possible to access the set mesh rotation.
Hi, can you help me, I’m trying to do the same thing, but I haven’t been successful yet, just let me see if I understand the solution. The On mouse button up, On mouse button down and on mouse move functions are overrides, right? they are located in the blueprint widget that contains the image of the material, while the set mesh rotation function is created in the actor that has the 2d scene capture component. I literally did everything right but when trying to rotate it, it doesn’t rotate and I get an error that it was not possible to access the set mesh rotation.
If I recall correctly, “Set Mesh Rotation” here must be in the actor you’re working with. Accessed none means that you’re attempting to run this function in a null (invalid) object. Ensure it’s not invalid. If you can share your code I can perhaps help!
Thanks for the answer, I managed to solve it, I realized that my widget didn’t find my object reference type variable from my actor preview, so what I did to solve it was go to event pre construct and use a get actor of class node and in the output promote for a variable, then it worked hahah
Well, I still lack knowledge in knowing how to work with variables, but thanks for your help, I took a look at your channel and your games are incredible, congratulations!
Hey! I’m having issues with the rotation I’m using “set relative rotation” instead of “add local rotation” because the result is much closer to what I’d like but each time I click, the actor goes back to its default rotation (0, 0, 0) then it starts rotating from that position. Is there a solution to this?
Using “add local rotation” makes the mesh rotate faster than light travels lol