I have a script that spawns an items in a terrain area affected by a heightmap. Unfortunately this means the item isn't very visible because it's partially "buried" into the incline. Only when walking into the square does the item pop out of the terrain.
Anyone found a clever general method to make items "float up" when spawning them on heightmapped terrain through a script?
Spawning an item on inclined terrain?
-
Ixnatifual
Re: Spawning an item on inclined terrain?
I attempted to do it by spawning the item in the air, hoping it would then drop down to the ground on top of the incline instead of inside it.
Doesn't help, though. The item is still halfway buried in the ground... or completely buried if it's a small item. My current workaround is to only allow the item to spawn on flattened squares in the area.
Code: Select all
spawnedItem:setPosition(entity.x, entity.y, entity.facing, entity:getElevation() + 1, entity.levelRe: Spawning an item on inclined terrain?
Did you try GameObject:setWorldPositionY(y)? You can make small intratile adjusments with it.
Something like rock_1:setWorldPositionY(.08) might do it. Although, it may popup above ground when you step on the tile...
Something like rock_1:setWorldPositionY(.08) might do it. Although, it may popup above ground when you step on the tile...