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: Body force

Previous Thread :: Next Thread 
jd678 is not online. jd678
Joined: 18 Apr 2008
Total Posts: 11529
04 Feb 2014 03:40 PM
Assuming this was a full script(don't have time to write it out on phone) would this work?

function MovePart(B, Pos1, Pos2)
CFrame = CFrame.new(Pos1, Pos2)
getVector = CFrame.lookVector
Force = Instance.new("BodyForce")
Force.Parent = B
Force.force = Vector3 . new(getVector)
end
MovePart(Workspace.Part1, Workspace.Part1.Position, Workspace.Part2.Position)
Report Abuse
jd678 is not online. jd678
Joined: 18 Apr 2008
Total Posts: 11529
04 Feb 2014 03:42 PM
Excluding the obvious syntax errors(thanks phone) would this work?
Report Abuse
jd678 is not online. jd678
Joined: 18 Apr 2008
Total Posts: 11529
04 Feb 2014 10:02 PM
Guess ill have to test it when i get the chance :p
Report Abuse
lolb3 is not online. lolb3
Joined: 16 Jan 2010
Total Posts: 2268
04 Feb 2014 10:05 PM
most likely. i gotta pee so tl dr sorry
Report Abuse
wazap is not online. wazap
Joined: 29 Jun 2007
Total Posts: 23234
04 Feb 2014 11:35 PM
Yes but inefficient. Why not just

function MovePart(B, Pos1, Pos2)

Force = Instance.new("BodyForce")
Force.Parent = B
Force.force = Vector3.new((Pos2-Pos1).unit)
end
MovePart(Workspace.Part1, Workspace.Part1.Position, Workspace.Part2.Position)
Report Abuse
jd678 is not online. jd678
Joined: 18 Apr 2008
Total Posts: 11529
05 Feb 2014 12:20 AM
@wazap

"Assuming this was a full script(don't have time to write it out on phone)"

it was just something real quick i made on my phone, I know nothing about Body Force/Gyro/Etc :(

Also, it doesn't have enough force, it returns as decimals less than 0. How am I to increase the force, so Part1 will move towards Part2?
Report Abuse
wazap is not online. wazap
Joined: 29 Jun 2007
Total Posts: 23234
05 Feb 2014 12:55 AM
the inefficiency wasnt the BodyForce. The inefficiency was that you made a CFrame then used lookVector property... which was like an unnecessary part.

As for not enough force
Force.force = Vector3.new(getVector)*20000--Change this to a lower number for less power.
Should solve it
Report Abuse
jd678 is not online. jd678
Joined: 18 Apr 2008
Total Posts: 11529
05 Feb 2014 06:51 PM
"decimals less than 0"

They round up to be 0, and anything * 0 = 0
Report Abuse
jd678 is not online. jd678
Joined: 18 Apr 2008
Total Posts: 11529
05 Feb 2014 06:57 PM
nvm fixed it :p
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