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: Calculating Trajectories

Previous Thread :: Next Thread 
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
06 Sep 2011 01:34 PM
[ Content Deleted ]
Report Abuse
citymaster22 is not online. citymaster22
Joined: 10 Jan 2010
Total Posts: 4993
06 Sep 2011 01:36 PM
Ok here.
SImple formula actually:
d = v * t

np = new position
op = old position

np = d + op

So here:

d = velocity * time
In roblox do this:
distance = speed * time
new position = (old position * direction) + distance
Report Abuse
citymaster22 is not online. citymaster22
Joined: 10 Jan 2010
Total Posts: 4993
06 Sep 2011 01:40 PM
Or do you want it the complicated way?
Report Abuse
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
06 Sep 2011 01:45 PM
[ Content Deleted ]
Report Abuse
citymaster22 is not online. citymaster22
Joined: 10 Jan 2010
Total Posts: 4993
06 Sep 2011 01:47 PM
Oh okay. Gravity, gravity gravity. Let's see. *Thinks*
What's roblox's gravity? And is air friction taken into account?

Report Abuse
MrgamesNwatch is not online. MrgamesNwatch
Joined: 02 Feb 2009
Total Posts: 7729
06 Sep 2011 01:51 PM
so many factors! O_O
Report Abuse
citymaster22 is not online. citymaster22
Joined: 10 Jan 2010
Total Posts: 4993
06 Sep 2011 01:52 PM
What I don't get is how gravity will be taken into account. ROblox gravity I think works this way:
After a set amount of time, it falls down a set amount of distance, and the speed increases a set amount.
Report Abuse
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
06 Sep 2011 01:54 PM
[ Content Deleted ]
Report Abuse
MrgamesNwatch is not online. MrgamesNwatch
Joined: 02 Feb 2009
Total Posts: 7729
06 Sep 2011 01:54 PM
someone told me what the gravity in roblox is (i was calculating kenetic and potential energy), but i can't remember it >:|
Report Abuse
citymaster22 is not online. citymaster22
Joined: 10 Jan 2010
Total Posts: 4993
06 Sep 2011 01:57 PM
...
Oysi, y ou said you wanted gravity to be taken into account. In order for that, I need to know roblox's gravity and then calculate the pull of it so you will have a accurate position...
Report Abuse
MrgamesNwatch is not online. MrgamesNwatch
Joined: 02 Feb 2009
Total Posts: 7729
06 Sep 2011 01:59 PM
would this help?
http://www.roblox.com/Forum/ShowPost.aspx?PostID=47250573
Report Abuse
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
06 Sep 2011 02:01 PM
[ Content Deleted ]
Report Abuse
citymaster22 is not online. citymaster22
Joined: 10 Jan 2010
Total Posts: 4993
06 Sep 2011 02:04 PM
d = v * t

np = new position
op = old position

np = d + op


d = velocity * time
In roblox do this:
distance = speed * time
gravityaffect = gravity * t
new position = (((old position * direction) + distance) - gravityaffect)

The robloxian gravity affect is 196.2 studs/second
It pulls down objects 192.6 studs every second.
Report Abuse
blockoo is not online. blockoo
Joined: 08 Nov 2007
Total Posts: 17202
06 Sep 2011 02:23 PM
g = gravitational acceleration
ang = launch angle
v = launch velocity
h = initial height

print(((v*math.cos(ang))/g)*(v*math.sin(ang)+math.sqrt((v*math.sin(ang))^2+2*g*h)

Just threw it together, unlikely it will work the first time
Report Abuse
blockoo is not online. blockoo
Joined: 08 Nov 2007
Total Posts: 17202
06 Sep 2011 02:24 PM
Oops, here:

print(((v*math.cos(ang))/g)*(v*math.sin(ang)+math.sqrt((v*math.sin(ang))^2+2*g*h)))

~A revolution is born when one forgets the meaning of "impossible"
Report Abuse
citymaster22 is not online. citymaster22
Joined: 10 Jan 2010
Total Posts: 4993
06 Sep 2011 02:25 PM
What's that??
Report Abuse
blockoo is not online. blockoo
Joined: 08 Nov 2007
Total Posts: 17202
06 Sep 2011 02:26 PM
Oh...mine will only give you how far it will travel, sorry 'bout that XP

~A revolution is born when one forgets the meaning of "impossible"
Report Abuse
citymaster22 is not online. citymaster22
Joined: 10 Jan 2010
Total Posts: 4993
06 Sep 2011 02:28 PM
That's what I thought so... Why did you use trig for no reason?
Report Abuse
blockoo is not online. blockoo
Joined: 08 Nov 2007
Total Posts: 17202
06 Sep 2011 02:31 PM
I didn't read his post thoroughly enough, so I thought that's what he was asking.

~A revolution is born when one forgets the meaning of "impossible"
Report Abuse
blockoo is not online. blockoo
Joined: 08 Nov 2007
Total Posts: 17202
06 Sep 2011 02:33 PM
Just a thought, why don't you set up a test round and record the position at various times during flight?

~A revolution is born when one forgets the meaning of "impossible"
Report Abuse
blockoo is not online. blockoo
Joined: 08 Nov 2007
Total Posts: 17202
06 Sep 2011 02:49 PM
Ok, how about this. The X and Z velocity should remain constant throughout flight until it lands:

time = #
velocity = #,#,#

print(velocity.X * time, velocity.Z * time)

Now just to figure out how to calculate the Y...

~A revolution is born when one forgets the meaning of "impossible"
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