Download

How can do any button to control the Z-axis rotation of the object?

How can do any button to control the Z-axis rotation of the object? Can anyone help me please?Thank you so much!

Hey and welcome to the Forum!

Could you explain your question a bit more? What exactly do you want to do with the “Z-Axis”?

hi!My English is very poor,so。。。you know 。。I need to do a Display Platform, there will be some of the exhibits in the Display Platform, then the player can control Display Platform rotate viewing the exhibits。 thank you。。

Well, Z-Axis is also called the “Yaw” of the Rotation. Let’s say you have an Actor that serves as your DisplayPlatform. And in the Blueprint Actor, you also setup the exhibits.

Now you need to Reference of that DisplayPlatform. This can be done via “Line Trace” and using the “HitActor” or via “Overlap”, using the OtherActor.

How you get the Reference is totally up to you. If you are stuck with that, check out this tutorial. It talks a lot about how to get References of certain Actors in your Game.

https://youtube.com/watch?v=EM_HYqQdToE

Now when you have the Actor reference, you can call “SetActorRotation” on it, where you can change the Yaw/Z Value.

What you could do is, as soon as you Press “E”, you perform a Line Trace. If the HitActor is the DisplayPlatform (Cast it to DisplayPlatform), you call a function/event on the DisplayPlatform
what enables Input for it. “Enable Input” is a function that every actor has build in.

Then you can define normal Button Inputs in the “DisplayPlatform” Actor, like “A” -> AddRelativeRotation(0.0, 0.0, 1.0), “D” -> AddRelativeRotation(0.0, 0.0, -1.0) etc.

Then you just need an additional KEY to give your Character the Input back. For example ESC or so.

There are multiple ways of doing this though.

ah。。。Thank you for your answer!But I don’t understand:confused:。。。Because I am a rookie。。so。。 Can you printscreen for blueprint?:wink: In addition I will go to try.