Placement system not working


as you can see, the object placement isn’t quite right. i need it to properly place the object ontop of the hexagon tile. this is the function that gets the cframe

function Static:GetPlacementCF(model: Model, tilePos: Vector3, tileSize: Vector3, rotation: number)
    return CFrame.new(tilePos.X, tilePos.Y + tileSize.Y, tilePos.Z) * CFrame.Angles(0, rotation, 0)
end

current behavior:

the desired behavior:

(black = tile, green = tilepos, yellow = elevation, red = the object)

You’ll have to reduce the amount you add based on the size by dividing it by 2. Currently, you’re adding the entire height of the tile from the middle, which will always be taller than it. Try this instead:

function Static:GetPlacementCF(model: Model, tilePos: Vector3, tileSize: Vector3, rotation: number)
    return CFrame.new(tilePos.X, tilePos.Y + tileSize.Y/2, tilePos.Z) * CFrame.Angles(0, rotation, 0)
end
1 Like

Your placement CFrame should be the target hex’s Position + 1/2 the Y size of the target hexagon + 1/2 the Y size of the placed item.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.