Add object height to CFrame equation

I am creating a mine spawner in my game.

I need to know how to add my mine’s height to its spawn position, so that it is not halfway in the ground.
image

while true do 
	--spawn mine every 5 seconds
	wait(1)
	
	if minePosition then
		local newMine = nil
		if math.random(1,100) <= 10 then 
			newMine = strongMine:Clone()
		else
			newMine = mine:Clone()
		end

		newMine.Parent = tower
		
		local cframe = CFrame.new(minePosition)
		cframe = cframe*CFrame.Angles(0,0,math.rad(90))
		
		newMine.PrimaryPart.CFrame = cframe
	end
	newPoint()
end
1 Like
local mineHeight = newMine.PrimaryPart.Size.Y
		
		local cframe = CFrame.new(minePosition)
		cframe = cframe*CFrame.Angles(0,0,math.rad(90))+Vector3.new(0,mineHeight,0)
2 Likes

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