Rocket friend


  • gif

    It uses a BodyForce and BodyGyro. I played around a lot with some different formulas for how much force to use and settled with this, where the force is proportional to the square of the distance. Its target is a moving point that circles above your head. The force is in the direction of the target plus the velocity of the head minus the velocity of the rocket. The gyro has an upward tilt so it doesn't look completely gravity defying even though it is.

    local head=script.Parent:WaitForChild("Head")
    local rocket=Instance.new("Part")
    rocket.Size=Vector3.new(1,2,1)
    rocket.CanCollide=false
    local mesh=Instance.new("SpecialMesh",rocket)
    mesh.MeshId="rbxassetid://31601976"
    mesh.TextureId="rbxassetid://31601599"
    mesh.Scale=Vector3.new(.75,1,.75)
    mesh.Offset=Vector3.new(0,-1,0)
    local fire=Instance.new("Fire",rocket)
    fire.Color=Color3.new(.5,.5,.5)
    fire.SecondaryColor=Color3.new()
    fire.Size=2
    fire.Heat=25
    local gyro=Instance.new("BodyGyro",rocket)
    gyro.MaxTorque=Vector3.new(math.huge,math.huge,math.huge)
    local force=Instance.new("BodyForce",rocket)
    local gravity=Vector3.new(0,rocket:GetMass()*196.2,0)
    rocket.CFrame=head.CFrame+Vector3.new(0,5,0)
    rocket.Parent=head.Parent
    while head.Parent do
    	local h=head.Position+Vector3.new(0,2,0)+CFrame.Angles(0,math.pi*2*((tick()/2)%1),0).lookVector*20
    	local p1=rocket.Position
    	local p2=h-rocket.Velocity+head.Velocity
    	gyro.CFrame=CFrame.new(p1,p2+Vector3.new(0,10,0))*CFrame.Angles(math.pi/2,0,0)
    	force.Force=(p2-p1).unit*((p2-p1).magnitude^2/10+10)+gravity
    	wait()
    end
    

    (in StarterCharacterScripts)


  • Oh, that's neat!

  • Global Moderator

    @1waffle1 Neat.

    Could a pr0 coder like chursalf make it target onto, fly into, and vaporize anything coming near you?? >:3


  • @Goulstem That would be cool.

    I think I would like to see what the rocket sees via camera manipulation.

    Idk. Maybe even be able to control the rocket when you're viewing what it would see.

  • Global Moderator

    @OldPalHappy Oooh like a controllable drone? I dig.

Log in to reply
 

Looks like your connection to Scripting Helpers was lost, please wait while we try to reconnect.