Making an Object Move

I’m trying to get an object (bluewall) in my world to move. PositiveHorizontalMovement is set to 0:200:0 (x:y:z) and BlueButtonWasPressed is an event that is called by a blueprint (which i have confirmed activates). My end plan is to use a function that calls a for each loop on the array at the bottom (it will have more walls later). However, when i test this, the object doesn’t move an inch. What’s wrong with this code to make an object move?

I just copied your code exactly and it works perfectly. Are you sure Positive Horizontal Movement is set? Try doing Print String on it just to be sure

37693-code2.png

This is what the output said.

Well, the way I see it can really only be two things:

Blue Button is not firing, or the Movement variable isn’t getting set. (although you just showed it is)

Try replacing the ButtonPressed with a key press instead and see if it works. If it doesn’t, remove the variable and put 200 in manually.

The blue button is firing because when i look at the blueprint while it simulates, the while line from the even to the set location glows and stimulates. I don’t know if this makes a difference, but this is located in the level blueprint. the blue button is making its own custom event that the level blueprint can hear, and this is activating in the level blueprint so i can have access to the actor.

Yeah, I copied your code in a level blueprint and worked like a charm.

Did you try what I said? I know it is firing, but troubleshooting can never hurt. If those two things I suggested don’t work, then I wouldn’t know what the problem could be…

You could also just create a whole separate code to see if it works, like I did. Here’s what I made and it worked:

I made a new project with a pillar from the starter set and made this. I’m not sure why, but E never fires, no matter how many times i hit E

Third Person? Top Down?

Try adding “Enable Input” after begin play to the Level Blueprint.

this is the top down template. i added the “enable input” after begin play like you recommended. no change. I watched the code as i simulated and there was no fire

After having some issues in a new project,I think I found an answer for you. Select your object, and check “movable”.

37697-aaaaaaa.png

See if that works in your original project.

Well first, you haven’t referenced the controller. “Get Player Controller”. Second, it won’t work in Top Down unless you go into the controller and uncheck “block input”

But I think I found your issue so I posted an answer… Let me know if it works! :slight_smile:

Due to a problem i’m trying to solve in another thread, i can’t test it in the real project (crashing when i hit play for some reason), but i tested it on the pillar in the fresh top down file. I enabled input and got the player controller and it moved when i hit E. I did check and my door was set to static, so that’s probably the problem. thanks for all the help!

The mobility section doesn’t appear on all objects… why ? how can I make any object move ?