97neko
|
  |
| Joined: 14 Sep 2014 |
| Total Posts: 16159 |
|
|
| 07 Jun 2015 06:55 PM |
if you have the hypotenuse and all angles
無料の魂 |
|
|
| Report Abuse |
|
|
|
| 07 Jun 2015 06:56 PM |
function Pythagorean_Theorem(a,b,c) return (a ^ 2) + (b ^ 2) == (c ^ 2) end
I think this would work.
a = First Leg b = Second Leg c = Hypotnuse |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 07 Jun 2015 06:57 PM |
cos(angle) = adj/hyp adj = hyp*cos(angle)
sin(angle) = opp/hyp opp = hyp*sin(angle) |
|
|
| Report Abuse |
|
|
97neko
|
  |
| Joined: 14 Sep 2014 |
| Total Posts: 16159 |
|
|
| 07 Jun 2015 06:57 PM |
um, i have the hypotenuse and the angles
無料の魂 |
|
|
| Report Abuse |
|
|
|
| 07 Jun 2015 06:59 PM |
function Pythagorean_Theorem(a,b) if tonumber(a) and tonumber(b) then return (a ^ 2) + (b ^ 2) end end
This will get the hypotnuse I think. I may be forgetting square root stuff. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 07 Jun 2015 06:59 PM |
fish, he HAS the hypotenuse and the angles HAS, like you know, he KNOWS what they are |
|
|
| Report Abuse |
|
|
97neko
|
  |
| Joined: 14 Sep 2014 |
| Total Posts: 16159 |
|
|
| 07 Jun 2015 07:01 PM |
@cnt, what angle do i plug in
無料の魂 |
|
|
| Report Abuse |
|
|
|
| 07 Jun 2015 07:02 PM |
| So you want to find what numbers will make a right triangle with the hypotnuse? |
|
|
| Report Abuse |
|
|
97neko
|
  |
| Joined: 14 Sep 2014 |
| Total Posts: 16159 |
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 07 Jun 2015 07:04 PM |
| You can plug in any angle, it will give you the side lengths adjacent to that angle and opposite (so don't get confused) |
|
|
| Report Abuse |
|
|
|
| 07 Jun 2015 07:06 PM |
\ A |\ B |-\ C
Let's say you've got triangle ABC; as shown above.
You know ∠A, ∠B, ∠C, and AC. For reference, a lowercase letter is the opposite of the uppercase angle. (i.e. a is opposite ∠A).
a = AC * cos(∠C) b = AC c = AC * sin(∠C)
Hope this helps. |
|
|
| Report Abuse |
|
|
97neko
|
  |
| Joined: 14 Sep 2014 |
| Total Posts: 16159 |
|
|
| 07 Jun 2015 07:19 PM |
well, actually, this is what i have: prntscr[DOT]com/7edhtj
I'm trying to set the bar to the hypotenuse, and I create the initial bar along the bottom line with the length of the hypotenuse, but because of how roblox rotates things, it will put part of the bar below the bottom line and part of it above, and it will also move it together, so i will need to get the hypotenuse positioned in the correct area.
I was going to try to get the A and B of half of the hypotenuse, since it is essentially being cut in half and move it up 'A' pixels to position it correctly, but it didn't work.
Wot do.
無料の魂 |
|
|
| Report Abuse |
|
|
97neko
|
  |
| Joined: 14 Sep 2014 |
| Total Posts: 16159 |
|
|
| 07 Jun 2015 07:23 PM |
local EquipUi = function() coroutine.resume(coroutine.create(function() local bar = Instance.new('Frame',plr.PlayerGui.HUD.UI) local final = Instance.new('Frame',plr.PlayerGui.HUD.UI) bar.BackgroundColor3 = BrickColor.new('Institutional white').Color final.BackgroundColor3 = BrickColor.new('Institutional white').Color bar.BorderSizePixel = 0 final.BorderSizePixel = 0 final.Name = 'final' while wait(1/60) do local abS = plr.PlayerGui.HUD.UI.AbsoluteSize local convPos = UDim2.new(0,abS.X * .15,0,abS.Y * .74) local pos,bool = camera:WorldToScreenPoint(tool.Barrel.Position) local m = ((pos.X-convPos.X.Offset)^2+(pos.Y-convPos.Y.Offset)^2)^0.5 local s = (pos.Y-convPos.Y.Offset)/(pos.X-convPos.X.Offset) final.Rotation = math.deg(s)
local adj = math.cos(math.deg(s)) * m/2 local opp = m/2 * math.sin(math.deg(s))
opp = opp
final.Size = UDim2.new(0,m,0,1) final.Position = UDim2.new(0,convPos.X.Offset,0,convPos.Y.Offset-opp) bar.Position = UDim2.new(0,pos.X,0,pos.Y) end end)) end
無料の魂 |
|
|
| Report Abuse |
|
|
CrowClaws
|
  |
| Joined: 04 Jul 2010 |
| Total Posts: 4466 |
|
| |
|