Create a grid and make player move only in lines

Hello,

I just started using UE4. In my game, I want to force the player to move strictly on a grid’s lines. I’ve managed to create a grid of points in 3D space but I have no idea how to implement some features I want. I’d appreciate some pointers on where to start.

As you can see this is a grid with debug circles. I need the following:

  1. I need to connect grid points with lines. DebugLine would be PERFECT if I it wasn’t only for debug. I need a solid line to connect those two points.

I thought of creating static meshes and procedurally add then to grid but I don’t feel that’s the best way to go. I’ve also tried to use splines but it feels too complicated. Is there really no method to just draw a straight line between two points?

  1. I need the lines to change color as the player moves on them. So let’s say a line is initially blue. When the player reaches the middle of the line, the line would be half blue half red. When the player finish crossing the line, the line would be full red.

So when the pawn is at 3/4 of a line, the line will be 3/4 red and 1/4 black. I searched but I didn’t find a way to partially change the material of a mesh like that. Am I even thinking the right way?

Again, I don’t expect a full solution. I wouldn’t want for anyone to spend their time on my problem. All I ask for is a few pointers. I’m a seasoned programmer but it’s literally my first steps in UE4 and Game Development. I’m not sure I’m even in the right mindset.

So yeah, please help me :slight_smile: Thank you all in advance!

1 Like

Hi,

Please re word what your trying to do.

cause I am confused.

you want your player to change color based on how close he is to a line ?

you want the line to change based on how close the player is ?

Are you trying to make like a random maze. or you only want a player to move on a certain line color ?

an end goal idea is what im looking for so i can give you guidance.

Ehm… I’m not sure, but

  1. You can use Traces (Raycasting) and manually update trace color using player location as arguments.
    Or you can use ParticleSystem - create simple beam and again bind it to player state.
  2. Moving between tiles - If player will interact with tiles, like select them with mouse etc. I will spawn a grid of
    BP Actors and interpolate between them via Timeline and AddWorldOffset. Or you can add NavMesh and using the
    same apporoach as TopDown template in EpicLauncher - use MoveToLocation. Additionally you can look at Turn
    Based Strategy from Epic Games and youtube stream about it… Thats it!

Hello,

I rephrased my question a bit. I need the following:

  • The player should move only on the lines
  • The line should change color based on how much the player has moved on it. For example, if the player walks ON the line and has already crossed 3/4 of it, the line would be 3/4 red and the remaining 1/4 blue.

For the line color, image that the player has a paint bucket and “paints” the line as he walks on it. Does that clear it up a bit?

Hello and thank you for your answer.

How can I visualize ray traces on production? I thought that you can only visualize them as lines on Development mode.