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
 

(physics) mass not making difference?

Previous Thread :: Next Thread 
LarzCaetano is not online. LarzCaetano
Joined: 26 Aug 2015
Total Posts: 280
08 Feb 2016 08:57 AM
p=script.Parent;
x=0;z=0; --initial pos (s0)
g=-9.81; --gravity (m/s*s)
m=5;v=0;s=25;a=0;f=0; --properties of p (part)
t=0;l=tick();

game:GetService("RunService").Stepped:connect(function()
t=tick()-l;l=tick();
f=m*g;
a=f/m;
v=v+a*t;
s=s+v*t;
s=s<=0 and 0 or s;
p.Position=Vector3.new(x,s,z);
end)

when i change the "m", which is the mass of the part, it doesn't affects the speed, why is that happening?
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
08 Feb 2016 08:58 AM
Because you divide by M after multiplying it, cancelling it out.
Report Abuse
LarzCaetano is not online. LarzCaetano
Joined: 26 Aug 2015
Total Posts: 280
08 Feb 2016 09:05 AM
another question...
why it's with a constant velocity? shouldn't it be like a Free Fall? Increasing the velocity?
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
08 Feb 2016 09:06 AM
Also, I don't understand quite what you're doing. Why don't you simplify it to a reasonable Verlet Integration implementation?

// Each frame
Velocity += NetForce;
Position += Velocity;
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
08 Feb 2016 09:10 AM
Or in Roblox:

local Gravity = Vector3.new(0, -9.8, 0)

local Points = {}
local R = math.random
for Num = 1, 20 do
table.insert(Points, {
Position = Vector3.new(R(-100, 100), R(100), R(-100, 100)),
Velocity = Vector3.new(R(-15, 15), R(-15, 15), R(-15, 15))
})
end

game.RunService.RenderStepped:connect(function()
for Index, Point in next, Points do
Point.Velocity = Point.Velocity + Gravity -- Add other forces here, if there are any.
Point.Position = Point.Position + Point.Velocity
end
end
Report Abuse
LarzCaetano is not online. LarzCaetano
Joined: 26 Aug 2015
Total Posts: 280
08 Feb 2016 09:11 AM
well, it's a simple free fall script
i don't want to use V.I. because i don't have the necessary knowings to use it
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
08 Feb 2016 09:13 AM
Well it's really easy. The whole concept is kind of what I summarized.
Ignore the math stuff on wikipedia unless you really need it, it's much simpler than that.

Just use force, add it to the velocity, and add velocity to position. The only tough part is figuring out what forces you need, and even that will come easy with practice.
Report Abuse
LarzCaetano is not online. LarzCaetano
Joined: 26 Aug 2015
Total Posts: 280
08 Feb 2016 09:18 AM
okay, i'll try that
thanks, @Jarod
but why is the part falling with a constant velocity?
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
08 Feb 2016 09:49 AM
I'm back. Give me a minute or five and I'll look into it.
Report Abuse
Happywalker is not online. Happywalker
Joined: 05 Mar 2010
Total Posts: 3672
08 Feb 2016 09:53 AM
because f doesn't change?


Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
08 Feb 2016 09:56 AM
Okay, I looked into it. I couldn't figure it out though. It only stops changing velocity when s<=0.

Try this.


p=script.Parent;
x=0;z=0; --initial pos (s0)
g=-9.81; --gravity (m/s*s)
m=5;v=0;s=25;a=0;f=0; --properties of p (part)
t=0;l=tick();

game:GetService("RunService").Stepped:connect(function()
t=tick()-l;l=tick();
f=m*g;
a=f/m;
v=v+a*t;
s=s+v*t;
p.Position=Vector3.new(x,math.max(s,0),z);
end)
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