Static mesh movement in character bp

Hi guys,

I want to learn to use UE4 so i thought: “im going to do a snake game!!”. Well, to start learning i want to move a cube with wasd controls, but i have some issues:

I set up the controls in the “proyect settings”. Then i put a static mesh as character (called “cabeza”) in my character blueprint (called “cabezaSerpiente”), but when i try to use it to recieve the inputs, the blueprint send this message: “cabezaDeSerpiente does not inherit from static mesh component (cast to cabezaSerpiente would always fail)”.

Does this mean that i cant use a static mesh as character? this should be the easiest way to begin right?

Hi sarebok,

The character’s mesh and the character actor are two completely different types, so you can’t cast one to the other. The static mesh is the visual representation, and is attached to the character. So yes you can use it but you don’t move it directly.

Assuming the graph above is inside your character blueprint, you should be able to disconnect the target pin of the Add Movement Input node so that it defaults to ‘self’ (your character instance). Then the character, and the mesh along with it, should move when input is applied.

67783-addinput.jpg

It doesnt work… in fact, im moving another thing but the static mesh…its like there was other thing in the viewport with controls assigned, but i dont understand what can be.

Im following this tutorial, with the exact same steps but it doesnt let me move the static mesh… just move another “thing” (like a first person char)…

i just realize that when im editing, just have 4 actors (fog, light, floor and my class blueprint), but when i start the game (with play button) it shows me 17 actors :O…

Its normal for the engine to spawn a bunch of extra actors when the game starts up.

In the tutorial you’re following, when you hit play you’ll take possession of the your character so you’ll be moving from its perspective. Could that be what’s happening?

If you want to change the perspective you can add a camera component to your character and modify its position so it’s viewing the mesh (like a third person view).

Alderbit thx so much! my game mode was not default in the settings… OMG literally nobody in any tutorial says this things… after about 6 hours i can move that ■■■■ box!! jajaja :stuck_out_tongue: thx a lot man