Hey, I’m relatively new to Unreal and still getting the hang of things, this is my first post, so please forgive me for potentially not following etiquette or rules properly. I’m currently trying to make a button system with two different interact prompts to either raise or lower another actor on it’s Y axis, incrementally with each interaction so they can adjust the height accordingly. I’m using this to make a level around raising and lowering water to move platforms. Any help would be appreciated.
1 Like
Questions that could determine how far down the rabbit hole you want to go:
- Do you want the buttons to be in-world (diagetic) or just buttons drawn on the UI?
- Did you mean the Z axis? In Unreal, the vertical axis has been the Z axis on every project I’ve worked on. Not sure if there’s a way to change that.
- Do you want the platform to move gradually over time or just snap position?
- Do you want button prompts on the buttons to display the bound key dynamically? e.g. “Press X to raise”, “Press space to lower”
- How do you want to determine if the player is in a position to change it’s height? Do they need to be looking at it? Do they just need to be close to it? Can they press it at any point in time?
- Does the player need to be able to change the height of the water on multiple bodies of water, or is there only one body of water?
1 Like
Thank you for your reply, here’s the answers to those questions:
- There would be actors representing a control panel of sorts with the prompts for something like: “Press ‘Y’ to raise water” and “Press ‘U’ to lower water”, or something similar.
- I think so? Again, I’m quite new and only know most of the basics, but I was meaning whatever axis is vertical.
- I figured I could timeline an animation for gradual changes, however it’s not necessary at this stage.
- Technically I answered this in 1.
- The player would get within the collision around the button, to then display the prompts.
- There will be several bodies for different segments of the level, with some having multiple switches within the segment.
Thank you again for any help you can provide and for your time.
Edit: I haven’t programmed any “real water” btw, I’m using an actor BP I created to represent the water for now, which kills the player if inside it for too long.
-
The first thing I would do is add the input behavior to the player character.
- Add input listeners for U and Y key (Fig 1)
-
So the first element I would create is the control panel.
-
Make an actor to represent the control panel.
- The visual geo may be as simple as a box (Fig 2)
- Add a box collision to act as your overlap trigger. (Also Fig 2)
- By default It should be set to overlap dynamic objects such as the player pawn.
- Transform trigger cube to taste.
- Add a text-render component to your control panel actor (fig 3)
- Make sure it is hidden by default (Stil fig 3)
- Add events for actorbeginoverlap and actorendoverlap (fig 4)
- At this point if you toss an instance of the console into your level, the text should turn on and off when you get near it.
- Create new events for raising and lowering to your control panel console. (Fig 5)
- Now you can tell the input events we added to the player character to call the raise/lower events on any overlapping consoles. (Fig 6)
- In the level, you can place the actor you want to move.
- I chose a simple blue chamfer cube.
- Make sure you set it’s transform mobility to “Movable” (Fig 7)
- In the level, place the destination locations you want your actor to move to
- I chose to just add a few instances of a basic actor (Fig 8)
- Back in the console actor blueprint, create variables for the actor you want to move, and the locations you want it to cycle between. (Fig 9)
- Make sure you make them instance editable.
- In the level viewport, select your control console instance, and populate the variables we just exposed with the appropriate instances. (Fig 10)
- Back in the control console’s blueprint, add some math to cycle the destination index of the target location.
- Increment/Decrement the index, and clamp it to valid values. (Fig 11)
- Lastly, use MoveComponentTo, to move the target actor to the destination actor. (Fig 12)
Fig 1
Fig 2
Fig 3
Fig 4
Fig 5
Fig 6
Fig 7
Fig 8
Fig 9
Fig 10
Fig 11
Fig 12
1 Like