Jump to content

Hacky way to spawn/teleport prefab at center of tile ?


Recommended Posts

Hi everyone, I'm currently struggling to find a solution to my problem : The title

I don't think there is a way to directly spawn something at the center of a tile on the world gen (if it is well it'll be awesome)

So I at least try to make a function for the prefab to teleport it to its current tile center

I've tried and my result is somehow...

0screen.thumb.jpg.878d365facbd94b7a2976e2fa26494da.jpg

Yeah Wilson, you're right.

Also, I don't want to use layout/static_layout for the spawn of those for reasonable reasons :)

Thanks a lot for the help... I mean, I can't find this my myself ^^

Just a quick reminder if it help, the worldgen spawn only a single prefab for each tile so that's why I need to teleport the prefab to its own tile

;)

Link to comment
Share on other sites

Welp no matter, I finder out something useful and it worked, thanks anyway if someone tried a solution

local cx, cy, cz = map:GetTileCenterPoint(x, 0, z)
inst.Physics:Teleport(cx, 0, cz)

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...