I use constraints to have my battleship move around based on player input, as seen below:
I am working on implementing this ship into a game I am working on, but the spawning of it usually wields horrific results, especially if I have its PrimaryPart set to something in the ship (like its hull), as seen below:
If I don’t set its PrimaryPart, it spawns in better, but its still not right.
I do not know or understand what is wrong here. The attached code I use for spawning the ship in + trying to position it correctly - the block I use to Pivot the ship to is a copy of the ship’s hull put at the spawn docks:
local clone:Model = obj.Value:Clone()
if clone:GetAttribute("isShip") == true then
local shipScript = require(scripts.weapons.ships)
local newBoat = shipScript.new(clone)
local engine = clone.Hull
local x,y,z = engine.AlignOrientation.CFrame:ToOrientation();
local realY = math.deg(x);
engine.AlignOrientation.CFrame = engine.AlignOrientation.Attachment0.WorldCFrame
end
clone.Parent = spawnZone
clone:PivotTo(spawnPoint.CFrame)
These are the important properties of the AlignPosition:
& AlignOrientation:
What can I do to mitigate this?