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 » Scripters
Home Search
 

Re: quick question

Previous Thread :: Next Thread 
XCVlll is not online. XCVlll
Joined: 23 Oct 2008
Total Posts: 963
20 Oct 2016 11:09 PM
would it be possible to create a parabola to cause a "gravity" effect on something being launched
Report Abuse
Thedagz is not online. Thedagz
Joined: 10 Mar 2012
Total Posts: 798
20 Oct 2016 11:10 PM
yes it is possible but its much more realistic to use a actual gravity formula for that
Report Abuse
XCVlll is not online. XCVlll
Joined: 23 Oct 2008
Total Posts: 963
20 Oct 2016 11:11 PM
such as what?
Report Abuse
Thedagz is not online. Thedagz
Joined: 10 Mar 2012
Total Posts: 798
20 Oct 2016 11:12 PM
projectile trajectory works out pretty well you can look it up
Report Abuse
XCVlll is not online. XCVlll
Joined: 23 Oct 2008
Total Posts: 963
20 Oct 2016 11:13 PM
ill check it out, thanks!
Report Abuse
newcoolman2 is not online. newcoolman2
Joined: 01 Apr 2010
Total Posts: 2637
21 Oct 2016 12:13 AM
I saw this post and I had tried something like this not too long ago.
Its just physics (which im not good at im taking that class this year)
I was just creating like bullet paths.
You can run this code and see a block move

ag=192.6

function trajectory(angle,velocity,height)
local v={}
v.x=velocity*math.cos(math.rad(angle))
v.y=velocity*math.sin(math.rad(angle))
v.maxHeight=(v.y/2*ag)+(height or 0)
v.time=(v.y/ag)
if height>0 then
v.fally=math.sqrt(2*ag*height)
v.fallTime=v.fally/ag
end
if v.fallTime then
v.totalTime=v.time+v.fallTime
else
v.totalTime=2*v.time
end
v.totalRange=v.x*v.totalTime
return v
end

function getPos(gunTraj,time)
local pos={}
pos.x=(gunTraj.x*time)
pos.y=(gunTraj.y*time)+(.5*ag*(time^2))
return pos
end

local barretTraj=trajectory(45,18000,4)
local bullet=Instance.new("Part",workspace)
bullet.Anchored=true
for i=1,math.ceil(barretTraj.totalTime)*1000,1 do
i=i/1000
local pos=getPos(barretTraj,i)
bullet.CFrame=CFrame.new(pos.x,pos.y,0)
wait()
end


Report Abuse
newcoolman2 is not online. newcoolman2
Joined: 01 Apr 2010
Total Posts: 2637
21 Oct 2016 12:29 AM
function getPos(gunTraj,time)
local pos={}
pos.x=(gunTraj.x*time)
pos.y=(gunTraj.y*time)+(.5*-ag*(time^2))
return pos
end



but oh well


Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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