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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 02 Apr 2008 |
| Total Posts: 467 |
|
| |
|
Teiwaz
|
  |
| Joined: 06 May 2013 |
| Total Posts: 12 |
|
| |
|
Hagar5000
|
  |
| Joined: 02 Apr 2008 |
| Total Posts: 467 |
|
| |
|