Spawn Grid Based on Landscape
Hey, hope you guys are doing great! This is my first post on UE answerhub, even though I’ve been reading and checking it since UDK. Sadly, that does not means I know a lot of the engine, on the contrary, I’m have trouble with what I think should be really simple things.
Recently, despite of not having that much time, I’ve decided to start working in a pet project, one I’ve been wanting to try my hands on for some time now.
The goal is to create a “real time, turn based combat”. The main point is that I want to have grid-based movement for the character and turn-based action. I’ve tried some tutorials and learned the following: I cannot have grid-based without spawning a grid to move on. The issue is that I wanted an ‘open map’ feeling or something similar. Procedural Room Generation helped me understand how to spawn a grid and how to use it to determine movement and how to set a ‘turn’ order.
So, I thought: “Well, why not create the grid, based on the player location when ‘combat starts’ and use it during ‘combat’ to determine movement?” The solution seemed at first easy to achieve could potentially solve my problem.
So, to test my solution, I created a small event on blueprint level, to spawn the grid once the F key is pressed:
As you can see, the grid spawn at the character location, which is good, however it doesn’t follow the terrain deformation, as you can see in the following image:
The blueprint used to spawn the grid is the following:
The question is: How to set the Z coordinate to match the one in the landscape? I tried creating a function that I would pass the xy position and use a linetrace based on it to return the z, but it didn't worked as I hoped It would.
P.S: Sorry for my poor English, it’s not my native language.
Follow this question
Once you sign in you will be able to subscribe for any updates here