BP 3 cubes rotate on key press - need to stop the one you're stood on from rotating until you step off

Hi everyone.

I currently have 3 cubes in 1 blueprint, that each rotate in 90 degree increments on key press.

Cube 1 rotates right 90 degrees on E key press, left on Q key press and on R key press it moves to cube 2, and again to cube 3 after that.

I cant find another way of creating this functionality at my current knowledge level, but I now need to make it so whichever cube you are stood on you cant rotate it while you are on it.

Currently all 3 cubes are in 1 blueprint and a sequence moves through the currently active cube to rotate 90 degrees. This set up is causing me trouble when it comes to stopping the movement of the cube you’re stood on.

Ive attached images of the blueprint setup so far.




Any help would be great, thanks.

Do it like this. Each cube is one BP:

and in the level BP:

Thanks for the setup - unfortunately it isnt working for me. Im not sure what ive set up differently though.

None of the cubes are rotating, or even triggering in the BP when in the game.

Here is what ive got -

In the Cubes array I have added CubeBP, CubeBP2 and CubeBP3 all of which are sitting in the level.

Did you enable input on all the blueprints?

also, you need to make sure you have ‘consume input’ turned off, otherwise one cube takes the input stream away from the others:

339341-screenshot-8.png

Once you get this working, you can pop cubes all other the level, and it will just work :slight_smile:

Other thoughts, looking at your code:

  1. I’m assuming you have something in the timeline? A curve that goes from 0 - 1

  2. You need a collision box around your cube to detect the player, notice in my picture :wink:

Thanks again.

I have now added the box, unticked consume input and changed the auto receive input.

It does now rotate once in each direction. However it doesnt add onto the rotation, each time I press the E key it rotates but snaps back to its initial location and rotates from there.

It also doesnt move to the second cube when I press the R key. I cant see why it wouldnt update the rotation rather than playing the same rotation over and over.

I never did test it! :slight_smile:

I will give you an update soon.

Not sure about the R key yet…

EDIT: Level BP corrected ( above ).

EDIT2: All corrected - really works! :slight_smile:

I predict your next question will be: ‘but I can press the key while it’s rotating’…

:wink:

Thank you so much for your consistent help with this, I know I might have been a bit of a pain with this.

Your method is much simpler in setup compared to what mine was, and it is indeed working now!!

My next question is what you predicted. I tried pulling from my old blueprint to enable input on begin play, and then disable it on key press, then re-enable it again after the timeline has played. In my old blueprint it worked, but it doesnt seem to want to with this.

Also is there an easy way to build on this, and make it so where i have 3 cubes that are the same blueprint (CubeBP), and add CubeBP_02 that has the same functionality but looks different, but still cycle through the cubes in sequence using the same single key press?

Thanks again!!

not at a machine right now, but u need to look at the doonce node, will come back

With the setup you have now, you can drag 100 cubes into the level, and it will work :slight_smile: you don’t need to change anything.

As far as blocking to stop extra input, like I say, DoOnce. The start looks like this:

and at the end, just reset it:

Ahh thats where you add the do once node, thanks! Thats a simpler and cleaner setup that I had with the disable and enable inputs.

Regarding the multiple cubes, I understand that I can drag as many as I want of the current blueprint into the map and that works.

I would like to have variants of this cube but still cycle through them in the same way but always using the same key press.

So for example, the current Cube would be as it is.

But then I’ll need Cube 02 that has a volume on top that boosts the player in a given direction.

Then Cube 03 will have a cannon on it that can shoot something.

And so on, so I can start to build a puzzle setup of different functions.

Im thinking its about adding a get all actors of class for the 3 different cube blueprints that I would have, and making an array which are all added together. But it doesnt seem possible to add separate arrays.

So would I duplicate the level blueprint node structure coming out of R key press, and have a custom event to trigger each new Cube BP variant thats added?

This all seems like it should be easier for me to understand. I think this is the last sticking point that I have with what I want to get to build a prototype.

Thanks again for all your help so far!!

Two ways to do it:

  1. Make it an array of actors, not the specific blueprint, you can have anything in there then. Slight downside is you have to cast to get at the boolean.

  2. You get into blueprint inheritance. You have to make a parent cube which only holds the stuff that will be common to all of them, and you derive from that for the particular case by right-clicking it in the content browser and choosing ‘child blueprint’.

It’s a bit too much to explain here, but here’s a tuut: