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: Stopping Momentum? (BodyThrust)

Previous Thread :: Next Thread 
Barbariancreep is not online. Barbariancreep
Joined: 23 Nov 2012
Total Posts: 1096
02 Apr 2016 01:09 AM
I've been working on trying to stop the momentum after a body thruster sends the part forward. This is what I got:

bt.Force = Vector3.new(-300, bt.Force.Y, bt.Force.Z)

local initialX = body.Main.Position.X
local initialZ = body.Main.Position.Z
local currentX = body.Main.Position.X
local currentZ = body.Main.Position.Z
while true do
initialX = body.Main.Position.X
initialZ = body.Main.Position.Z
wait(1)
currentX = body.Main.Position.X
currentZ = body.Main.Position.Z
if currentX - initialX < 1 and currentX - initialX > -1 then
if currentZ - initialZ < 1 and currentZ - initialZ > -1 then
bt.Force = Vector3.new(0, bt.Force.Y, bt.Force.Z)
end
end
end

But it seems to go backwards instead. Help?
Report Abuse
Barbariancreep is not online. Barbariancreep
Joined: 23 Nov 2012
Total Posts: 1096
02 Apr 2016 01:20 AM
bump
Report Abuse
Riderj is not online. Riderj
Joined: 15 Aug 2011
Total Posts: 1534
02 Apr 2016 01:38 AM
Scale the force proportionally with the forward force. So if the forward thrust is 100 newtons and you have an opposing force of 100 newtons, the forward thrust will decrease. Since the forward thrust has decreased the opposing force will also need to decrease since it's now, say 90 newtons forward and 100 newtons backwards. Since the backwards force is greater than the forward it will start sending the object in reverse.
Report Abuse
Barbariancreep is not online. Barbariancreep
Joined: 23 Nov 2012
Total Posts: 1096
02 Apr 2016 01:47 AM
So I should make 2 bodythrusts? To go opposite directions? If not, how do I counter it?
Report Abuse
Barbariancreep is not online. Barbariancreep
Joined: 23 Nov 2012
Total Posts: 1096
02 Apr 2016 02:19 AM
b
Report Abuse
Riderj is not online. Riderj
Joined: 15 Aug 2011
Total Posts: 1534
02 Apr 2016 02:22 AM
You could add a second one that is the opposite of the initial one and update them synonymously, probably the easiest solution. May not be the best, but it will work if you don't want to do math.
Report Abuse
Barbariancreep is not online. Barbariancreep
Joined: 23 Nov 2012
Total Posts: 1096
02 Apr 2016 02:45 AM
It's still going, I did the wrong thing.


local bt = part.BodyThrust
local brt = part.BrakeThrust

-- Go

if key.KeyCode == Enum.KeyCode.W then
brt.Force = Vector3.new(0, bt.Force.Y, bt.Force.Z)
bt.Force = Vector3.new(300, bt.Force.Y, bt.Force.Z)
end

wait(x)

-- Stop

if key.KeyCode == Enum.KeyCode.W then
brt.Force = Vector3.new(-300, bt.Force.Y, bt.Force.Z)
end
Report Abuse
Barbariancreep is not online. Barbariancreep
Joined: 23 Nov 2012
Total Posts: 1096
02 Apr 2016 03:12 AM
b
Report Abuse
Barbariancreep is not online. Barbariancreep
Joined: 23 Nov 2012
Total Posts: 1096
02 Apr 2016 03:28 AM
b
Report Abuse
Barbariancreep is not online. Barbariancreep
Joined: 23 Nov 2012
Total Posts: 1096
02 Apr 2016 05:14 AM
bump

Help?
Report Abuse
Barbariancreep is not online. Barbariancreep
Joined: 23 Nov 2012
Total Posts: 1096
02 Apr 2016 05:53 AM
Surly someone knows
Report Abuse
Barbariancreep is not online. Barbariancreep
Joined: 23 Nov 2012
Total Posts: 1096
02 Apr 2016 06:18 AM
http://forum.roblox.com/Forum/ShowPost.aspx?PostID=186559318
Report Abuse
Barbariancreep is not online. Barbariancreep
Joined: 23 Nov 2012
Total Posts: 1096
02 Apr 2016 07:24 AM
^
Report Abuse
Barbariancreep is not online. Barbariancreep
Joined: 23 Nov 2012
Total Posts: 1096
02 Apr 2016 08:00 AM
b
Report Abuse
direMitten is not online. direMitten
Joined: 18 Jun 2015
Total Posts: 1294
02 Apr 2016 08:17 AM
If you just want to make the part stop moving, but in a BodyVelocity instance with a Velocity of (0, 0, 0) and a MaxForce > 0
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