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
 

Tilting with BodyPosition

Previous Thread :: Next Thread 
Hagar5000 is not online. Hagar5000
Joined: 02 Apr 2008
Total Posts: 467
26 May 2013 03:47 PM
I have an airship with 2 BodyPosition bricks, one on the front and back. I want the ship to be able to tip left and right a bit, but not a ton, so I made this script...

while wait(0.1) do
local LeftEngine = script.Parent.Parent.LeftEngine
local RightEngine = script.Parent.Parent.RightEngine
local LeftY = LeftEngine.Engine.Position.y
local RightY = RightEngine.Engine.Position.y
local Integrity1 = LeftEngine.Integrity
local Integrity2 = RightEngine.Integrity
local Level = script.Parent.Level.BodyAngularVelocity

local List = LeftY - RightY
Level.angularvelocity = Vector3.new(0, 0, List * 5)
Level.maxTorque = Vector3.new(0, 0, (((Integrity1.Value + Integrity2.Value) / 2) * 1000000))
end

LeftEngine and RightEngine are used to measure the Y-value difference between each side of the ship, so it can compensate with a BodyAngularVelocity. This works, but only if the ship is facing in one direction. If it turns around, the ship tries to tilt itself upside down. Is there an easy way to fix this?
Report Abuse
Hagar5000 is not online. Hagar5000
Joined: 02 Apr 2008
Total Posts: 467
26 May 2013 03:48 PM
Oh, and Integrity has to do with engine damage. So it has trouble stopping tilt if the engines are damaged.
Report Abuse
Geomaster is not online. Geomaster
Joined: 05 Jul 2008
Total Posts: 1480
26 May 2013 03:50 PM
Limit how much it can tilt left or right, using minimum-maximum values.
Visually speaking, about 30 degrees either way looks physically possible.
Report Abuse
Hagar5000 is not online. Hagar5000
Joined: 02 Apr 2008
Total Posts: 467
26 May 2013 03:51 PM
And how would I go about doing that? :l
Im not good with this rotational stuff
Report Abuse
Hagar5000 is not online. Hagar5000
Joined: 02 Apr 2008
Total Posts: 467
26 May 2013 04:07 PM
Hello?
Report Abuse
Teiwaz is not online. Teiwaz
Joined: 06 May 2013
Total Posts: 12
26 May 2013 05:06 PM
< 3
Report Abuse
Hagar5000 is not online. Hagar5000
Joined: 02 Apr 2008
Total Posts: 467
26 May 2013 05:30 PM
Thats not helpful
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