Rotate an object by touch

Hi. This is kind of a two part question. I am making a mobile game that has the default joysticks on the screen. I have a matinee in my game where I know I can tick the hide the HUD box and the joysticks disappear. What I want is for the player to collect an artefact and then have the screen change to a black background (with my HUD and the default joysticks gone) and two buttons that when touched will rotate the object either left or right to “examine it” or press a back button to return to the playing screen.

I don’t think I can do this in Matinee because I would have to specify a time duration.

What is the simplest blueprint setup to help this.

Any help would be greatly appreciated.

Thank you,
Ben

a couple ways to do this, but to describe the general communication process i’ve attached some blueprint screenshots. ultimately, you’ll probably want to use interfaces because i’m assuming you will have lots of artifacts. ‘Game Ready AI’ twitch streams explain this pretty well when the create the system for AI to pickup objects.

first image: on overlap, character checks if it’s an object type, then clears joysticks, then creates widget and tells that widget what the object was it overlapped with. that widget has a variable ‘myObject’ that is used to store this information.

second image: widget is created and now has something assigned to variable myObject. so, when you create your buttons ‘Onpressed’ function, call the newly created custom event ‘Rotate’ through a gate and pass to it myObject and speed.

[edit] updated image to reflect flow of rotation through a gate on press/release

Hi Paradoc,

Thank you for your answer, The rotate function is great. I have added two buttons so the object can be rotated left and right. I can also switch between two objects depending on the triggers but I am still having difficulty.

What I have is a HUD with Health etc. When I enter a trigger box for an artefact (only way I could do it I cant get an overlap of the actual object to work) I hide the virtual joysticks, the player HUD and get the new HUD to become active. I have a blank cube with the object in front of it so you can rotate to examine it. To do this I had to place a camera actor and switch the views from the third person camera to the one facing the artefact. However I also have a back button that I want to remove that HUD and return to the player one with the virtual joysticks working again. I can’t get the new “artefact” HUD to disappear.

I hope this makes sense. Your examples of selecting ‘myObject’ and the rotating via the HUD were perfect but I am having difficulty switching the visibility of the HUDs as I can’t reference the level blueprint from the HUD Graph - hopefully that makes sense.

Thank you,
Ben

you can probably write specific functions in your player controller that control hud states. so function or custom event ‘show gameplay hud’ would always clear any existing widgets, and create the gameplay widget. or event ‘show artifact hud’ would always clear any existing widgets and create the artifact widget.

with this kind of control, you can just call these functions from where ever. so on overlap, call your created function ‘show artifact hud’ which executes the blueprint in the first image and ends up drawing the artifact hud. when the artifact widget is active, and you press your back button, you then cast your widget owner to your player controller, and call ‘show gameplay hud’.

with this method, you can control your hud states from a single location that you know will always have access to variables and stuff associated with your widgets.

btw, to clear all your widgets, Rama wrote a good tutorial about this, but if time is limited or you’re adverse to using C++, just store your widgets in a userWidget variable, and always set this variable to whatever your active hud widget is. that way you can just grab this variable and call ‘remove from parent’ whenever you need to’.