Stop Rotating Button When Blueprint, Mesh Is Rotated?
I have a Blueprint with a Static Mesh, which has buttons components attached to the item.
I rotate the item in real time, so players can set objects in the game. (Please see screenshot) But I am trying to NOT ROTATE the buttons, so they are always showing to the player (Top Down Screen).
How would one setup buttons on a Blueprint, (for a Top Down Game), when players rotate the object. The buttons are not rotating with the object?
asked Jul 24 '14 at 07:07 PM in Blueprint Scripting
Are these buttons a child of the mesh? Normaly a child rotates with his parent at some point.
If it's only Top Down, you should just get the Button and set it's rotation to a fix value that points upwards. You can also calculate the direction from the position of the button to your character or camera.
If i remember correctly, you need to get the world location of the button and of your character, subtract the button position from the character position and use the 'x' value of that outcome for a rotation. This x value thing is just breaking some vector nodes and using the axis alone, than "Make rotation from X" and plug it back in.
That setup should always point the button in your direction. But it could be, that you only need the fix value. I don't know your exact gamesetup.
answered Oct 03 '14 at 11:17 AM
Essentially, the issue is that your buttons are components of the actor, so they rotate with it, as you'd expect. What you really want is to keep your buttons at a constant world-oriented rotation, rather than a constant local rotation, if I'm right. This is fortunately quite easy to do. In your construction script (or on tick if the object needs to rotate during gameplay), you can use the SetWorldRotation node on the buttons, which sets their rotation irrespective of their parent's rotation. If you set this to a constant value (or some other calculated value that doesn't include the actor transform), then the buttons will stay in the same rotation as the blueprint rotates.
If the buttons are not positioned locally at 0,0,0, though, they may move around as the parent rotates, but you can do a similar thing with the SetWorldLocation node in blueprints, only this time, you'd need to use the actor location (but not rotation) to ensure the buttons move correctly with the blueprint,
answered Oct 03 '14 at 11:09 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here