generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Super Glider Problem

Previous Thread :: Next Thread 
RoyMer is not online. RoyMer
Joined: 06 Jan 2010
Total Posts: 1922
11 Sep 2012 09:56 AM
I've been making a game where you get points by flying with the glider through a circle which has a false cancollide brick inside of it that gives points. But there's only one problem, this Glider stops from gliding every time it touches a brick. I tried messing around with it's script but can't fix it.

The scripts are inside this gear:
http://www.roblox.com/Explosive-Super-Glider-item?id=92142950
Report Abuse
cart6157 is not online. cart6157
Joined: 28 Feb 2009
Total Posts: 2194
11 Sep 2012 10:04 AM
Post the scripts dude.
Report Abuse
MrChubbs is not online. MrChubbs
Joined: 14 Oct 2010
Total Posts: 4969
11 Sep 2012 10:04 AM
Have you considered the the glider is supposed to stop when it touches somthing?
Report Abuse
RoyMer is not online. RoyMer
Joined: 06 Jan 2010
Total Posts: 1922
11 Sep 2012 10:20 AM
This is it's script:

--imports
local RbxUtility = LoadLibrary('RbxUtility')
local Create = RbxUtility.Create

--main vars
local Tool = script.Parent
local Equipped = false
local Flying = false

--character stuff
local Character, Player, Humanoid, Torso;

--anim tracks
local GliderHold, GliderFly, GliderBomb;


---========================== main code ==========================--

local FlyingGyro;
local FlyingForce;

local DesiredFlightCFrame;

local Gui;

local function BeginFlight()
Humanoid.Jump = true
wait(0.2)
if Flying then return end
Flying = true
game.Workspace.CurrentCamera.CameraSubject = Tool.Handle
game.Workspace.CurrentCamera.CameraType = 'Track'
Humanoid.Sit = true
FlyingGyro = Create'BodyGyro'{
Parent = Torso;
maxTorque = Vector3.new(0,0,0);
cframe = Torso.CFrame;
}
FlyingForce = Create'BodyForce'{
Parent = Torso;
force = Vector3.new(0,0,0);
}
Spawn(function()
for i = 0, 1, 0.1 do
FlyingGyro.maxTorque = Vector3.new(i*10000,i*10000,i*10000)
end
end)
GliderFly:Play(0.3)
DesiredFlightCFrame = (Torso.CFrame - Torso.CFrame.p)*CFrame.Angles(0, 0, 0.01)
Gui.Frame.Message.Text =
"Click and Hold to direct yourself.\n"..
"Fly through the circles to earn money."
end

local function EndFlight()
Flying = false
game.Workspace.CurrentCamera.CameraSubject = Character
game.Workspace.CurrentCamera.CameraType = 'Custom'
GliderFly:Stop(0.3)
Humanoid.Sit = false
FlyingGyro:Destroy()
FlyingForce:Destroy()
--Torso.Velocity = Vector3.new(0,0,0)
Torso.RotVelocity = Vector3.new(0,0,0)
Torso.CFrame = CFrame.new(Torso.Position)
Gui.Frame.Message.Text =
"Click to Glide."
end


local function GetMassOf(model)
if model:IsA('BasePart') then
return model:GetMass()
else
local mass = 0
for _, ch in pairs(model:GetChildren()) do
mass = mass + GetMassOf(ch)
end
return mass
end
end


local LastBombAt = tick()
local RELOAD_TIME = 0.8
local function DropBomb()
if not Flying then return end
if tick() - LastBombAt > RELOAD_TIME then
LastBombAt = tick()
--
GliderBomb:Play()
--
local bomb = Create'Part'{
Size = Vector3.new(1,2,1);
TopSurface = 'Smooth';
BottomSurface = 'Smooth';
Archivable = false;
Position = (Character['Left Arm'].CFrame*CFrame.new(0,-1,0)).p - Vector3.new(0,2,0);
--
Create'SpecialMesh'{
MeshId = 'http://www.roblox.com/asset/?id=64445837';
TextureId = 'http://www.roblox.com/asset/?id=64445853';
};
--
Create'Sound'{
Name = 'ExplodeSound';
SoundId = 'rbxasset://sounds//Kid saying Ouch.wav';
};
}
--
local sc = Tool.MineScript:Clone()
sc.Disabled = false
sc.creator.Value = Player
sc.Parent = bomb
--
bomb.Parent = game.Workspace
end
end

local function Slerp(t, a, b)
local om = math.acos(math.min(1, a:Dot(b)))
if om < 0.01 then
return (1-t)*a +
t *b
else
return (math.sin((1-t)*om)/math.sin(om))*a +
(math.sin( t *om)/math.sin(om))*b
end
end


while not Tool:FindFirstChild('Handle') do wait() end
Tool.Handle.Touched:connect(function(part)
if Equipped and not part:IsDescendantOf(Character) and Flying then
EndFlight()
end
end)


Tool.Equipped:connect(function(mouse)
Character = Tool.Parent
Player = game.Players:GetPlayerFromCharacter(Character)
Humanoid = Character.Humanoid
Torso = Character.Torso
--
Equipped = true
--
GliderHold = Humanoid:LoadAnimation(Tool.ANIM_Hold)
GliderFly = Humanoid:LoadAnimation(Tool.ANIM_Fly )
GliderBomb = Humanoid:LoadAnimation(Tool.ANIM_Bomb)
--
GliderHold:Play()
--
local MouseDown = false
local KeyState
mouse.Button1Down:connect(function()
MouseDown = true
if not Flying then
BeginFlight()
end
end)
mouse.Button1Up:connect(function()
MouseDown = false
end)
mouse.KeyDown:connect(function(key)
if key == ' ' then
if Flying then
EndFlight()
end
elseif key:byte() == 48 or key:byte() == 45 or key:byte() == 50 or
key:byte() == 52 or key:byte() == 13 or key:lower() == '' or key:lower() == ''
then
DropBomb()
end
end)
--
Gui = Create'ScreenGui'{
Parent = Player.PlayerGui;
Create'Frame'{
Name = 'Frame';
Style = 'RobloxRound';
Position = UDim2.new(0.5, -125, 1, -170);
Size = UDim2.new(0, 250, 0, 80);
Create'TextLabel'{
Name = 'Message';
TextWrapped = true;
BackgroundTransparency = 1;
Font = 'Arial';
FontSize = 'Size14';
TextColor3 = Color3.new(0.9, 0.9, 0.9);
Text = "Click to Glide";
Size = UDim2.new(1,0,1,0);
};
};
}
--
local LastTime = tick()
while true do
local Now = tick()
local dt = Now - LastTime
LastTime = Now
--
if Flying then
--make me fly
local moveDir = game.Workspace.CurrentCamera.CoordinateFrame*CFrame.Angles(0.6, 0, 0)
if MouseDown then
local theta = math.acos(DesiredFlightCFrame.lookVector:Dot(moveDir.lookVector))
local frac = math.min(1, 1.5*dt/theta)
local unit = Slerp(frac, DesiredFlightCFrame.lookVector, moveDir.lookVector)
print(unit)
DesiredFlightCFrame = CFrame.new(Vector3.new(0,0,0), unit)
end
--
local velo = Torso.Velocity
local veloXZ = (velo - Vector3.new(0, velo.y, 0))
--
local dir = DesiredFlightCFrame.lookVector
local dirXZ = (dir - Vector3.new(0, dir.y, 0)).unit
--
FlyingGyro.cframe = DesiredFlightCFrame*
CFrame.Angles(0, 0, Torso.RotVelocity.y/3 * (1-math.abs(dir.y)^2))*
CFrame.Angles(-math.pi/2, 0, 0)
--
local headingForceFactor = -dir.y -- heading up => negative force
local liftForceFactor = dir.y --hading up => positive lift
--
local forwardsSpeed = math.max(0, velo.magnitude)
--
local weight = GetMassOf(Character)*20*9.81
--
local dragForce = (velo.magnitude/10)^2 * weight
local dragForceY = (velo.y/15)^2 * weight
local dragForceXZ = (veloXZ.magnitude/35)^2 * weight
--
local suspendFactor = 0
if dir.y < 0 then
suspendFactor = (-dir.y)^2
end
--
FlyingForce.force = Vector3.new(0, weight*(1.0 - suspendFactor + 0.3*liftForceFactor), 0)
+ (dirXZ * (weight*1.0 * math.max(0, (0.5*headingForceFactor+0.6))))
- (veloXZ.unit * dragForceXZ)
- (Vector3.new(0, velo.y, 0).unit * dragForceY)
--
--print(string.format("RotVelocity: %.1f, Velo: %.2f",
-- Torso.RotVelocity.y, velo.magnitude))
end
wait()
end
end)

Tool.Unequipped:connect(function()
if Flying then EndFlight() end
Equipped = false
--
if Gui then
Gui:Destroy()
end
--
GliderHold:Stop()
GliderFly:Stop()
GliderBomb:Stop()
end)
Report Abuse
president101 is not online. president101
Joined: 19 Jul 2011
Total Posts: 28550
11 Sep 2012 10:56 AM
thx for the script!!
Report Abuse
RoyMer is not online. RoyMer
Joined: 06 Jan 2010
Total Posts: 1922
11 Sep 2012 11:17 AM
I just need to know how to make it stop from falling when it touches something.
Report Abuse
Sento467 is not online. Sento467
Joined: 26 Feb 2009
Total Posts: 31
26 Aug 2013 08:33 PM
Wow. Sorry, its been a couple years :P Just found this post. Working on a project myself. But hey, I have the answer.


In the "Glider_LocalMain" Script, all you have to do, is erase this passage [Below] or this action in the script. You can find this action around the middle of the script. Here it is.

while not Tool:FindFirstChild('Handle') do wait() end
Tool.Handle.Touched:connect(function(part)
if Equipped and not part:IsDescendantOf(Character) and Flying then
EndFlight()
end
end)


I hope you still have your idea, good luck!
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image