Hey All,
I have a missile that flies, but does so in a vertical position. The missile is scripted to follow a spacecraft using BodyPosition placed in a part in the center of the missile. I tried to correct the problem by using CFrame to have the center part face towards the spacecraft using the script line:
orientationPoint.CFrame = CFrame.new(orientationPoint.Position, spacecraft.Position)
It didn’t work. Any thoughts on how to level out the missle?
Here is the full movement script for the missile:
-- Moves the rocket to a desired position
local orientationPoint = script.Parent.MissileSpawn
local bodyPosition = script.Parent.Center.BodyPosition
local spacecraft = game.Workspace.ParkerShip3.SpaceFrame
while true do
local spacecraftPosition = spacecraft.Position
bodyPosition.Position = spacecraftPosition
orientationPoint.CFrame = CFrame.new(orientationPoint.Position, spacecraft.Position)
wait(.01)
end
Here is a video of the missile chasing the spacecraft. The big yellow sphere is the part that will register contact between the missile and the spacecraft; visible only while I work on it. The grey brick on the side of the sphere is to help me orient which side of the rocket was facing the spacecraft. To be removed once complete.
robloxapp-20210225-1955508.wmv (732.0 KB)
Any thoughts?