Set location of a spawn actor so that it stands perfectly on the ground?
question is in the title. I need the BP solution :D
Thanks in advance :D
asked May 09 '15 at 04:11 PM in Blueprint Scripting
The BP solution is mostly here... https://answers.unrealengine.com/questions/72822/how-to-read-landscape-heightmap-at-runtime.html
Then you need to ge tthe Actor exactly on the ground. I just use a fudge factor to add a little to Z so they are a hair off the ground. Or add a bit mor and they fall for 0.5 seconds to the ground on spawn.
If there is an obstacle like a rock, building, etc on that spot then you have to get smarter about where you spawn. Thus there are Player Start points in Unreal that you place by hand.
You can also loop through the hit list in the BP solution and decide which surface has priority. Buildings are a problem because the roof may not be a good spawn point, so you search downard for a floor surface. And it can get very complex.
Another approach is to always spawn on open griound and do a random search within a rectangle of where you want to spawn. Maybe within +-50 meters. And limit your tries to maybe 50. If you can;t find a spot in 50 tries just spawn anyway 0.5 meters above the highest solve point so they fall to the roof/rock/tree/whatever.
answered May 09 '15 at 08:00 PM
SND R Keene
Follow this question
Once you sign in you will be able to subscribe for any updates here