I’m trying to make a One Tap mobile game and am struggling with that type of movement. Ive tried having a “Target Bp” then i get all actors of that class and try to make the character move to the closest one. I can’t really get it to work though does anyone have any ideas?
Could you provide another game as an example of what you’re trying to do? Trying to understand the functionality you’re trying to create.
I’m trying to make something similar to crossy road or frogger
i still am trying to figure this out im cant get it fully working though
If you’re on flat ground the whole time ( no terrain differences ) easiest way would just be to use a camera trace, get the vector hit for location. Should be able to get a reliable distance.
You’ll then likely want to use something similar to what Epic has for the “Top Down” example. It uses an AI Move To to make the player move to the location of the mouse. (will be used with trace in your circumstance)
I’m sure there’s a way to force input in one direction, but if you’re going for something simple the above would be my suggestion for a solution
I’m trying to have “Tiles” that i can place for the player to move on. But i only want the player in the middle of that tile. Then when you tap the screen it moves to the middle of the next tile. The camera trace works but i feel like the system i explained would be better. I just can’t figure out how to make it work well. I would also like to add “Tiles” on either side of others so you can pick a direction Left/Right/Up/Down then 1 tab for that direction will take you to the next “Tile”. I’m using Tile as a term for my floor meshes to kinda give a idea.
If you’re procedurally generating the tiles, you could add the “location” for the middle of each tile into a vector array that the player would hold/be able to access somehow.
Increment upon that array and remove an index each time you move.
Again, you’d want to use the AI move to though.
Hope this helps!
ill try to use Ai move to when I try it. I’ve been using simple move to or movement inputs that may be the problem
So i tried what you said im not sure if im doing it right though. Here is what i have, I have a Navmesh Volumes down, Ive also tried to get different references to the blueprint im using as the location. Ive also tried moving the pins around to see if i got them backwards none of it will work :/. I just want a type of grid movment. You tap the screen once and the character moves one square forward,left,right or down based on the direction they swipe. I have the swipe stuff setup im just trying to make the player move to a certain point and stop.
Can’t you just increment the worldposition with the tile diameter? As long as you start in the middle of a tile and only move by the tile diameter it will always move to the middle. Diagonals are just pythagoras.
Here I used a key press to Jump. Just plug the same thing in to your swipe/tap direction and adjust axis accordingly.
That didn’t work for me. I thought the scene root would be reference to the location you want the player to go to correct? So i got a reference to a actor blueprint and set that as the world location. The player didn’t move anywhere or do anything. I did not try it with my swipes because i couldn’t get it to work without them.
No, the scene root is the player. I was just incrementing his own position with the tile diameter. If every tile is the same size you don’t really every need to know the position of the target, you just always move the player 1 tile distance. If you have the targets location can’t you just use GetWorldLocation on your target and SetWorldLocation on your player? I might be missing something as this doesn’t seem all that complicated…
If the player has different dimensions to it’s target you can probably use the GetBoundingBox node to offset the difference.
I deducted the difference in size, assuming the player is always smaller that the tile/target it’s moving to. I divided them by 2 because I want half of the distance each side.
OR you could make sure the pivot point of every parent object in a blueprint is in it’s centre so no matter what size it is, matching 2 objects world location will always put one in the centre of the other.
Sorry im still not able to get the results im looking for. So i have a Platform blueprint, with a sphere collision ontop of the platform that im using to get a reference to for a location. I place these Platform blueprints to make the level. My goal is to have the player move to the location of the sphere collison that is in the Platform blueprint. Ive done similar stuff before without a problem for some reason this is not working. I’m trying to avoid using the Level Blueprint for this but maybe it would be easier. I am getting reference from all actors of that Platform class. Maybe thats the problem? Is there another way to get reference to another actor blueprint? I tried casting and it didn’t seem to work either.
Maybe change the Actor variable holding the clicked collision to a Object reference instead of a class reference?
I tried that and it didn’t work. I think im just going to use target points and the Level Blueprint. I was just trying to get it a little more automated so that i could make super quick levels because i have 50+ to make and it will take alot of time this way.