|
| 12 Jan 2014 04:52 AM |
How do I calculate the distance between Z? I know how to calculate the X and Y but daym idk how to calculate Z...
HOW? For example there are two bricks named p1 and p2, now I want to know the Z difference between those two bricks. |
|
|
| Report Abuse |
|
|
| |
|
|
| 12 Jan 2014 06:31 AM |
| Not sure if trolling or genuine stupidity... |
|
|
| Report Abuse |
|
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
|
| 12 Jan 2014 07:13 AM |
math.abs(a.Z-b.Z)
Where a and b are the position vectors of the parts
|
|
|
| Report Abuse |
|
|
|
| 12 Jan 2014 07:17 AM |
@lamp
yep genuine stupidity, well i was expecting a diff formula for this but... nvm i figured it out, tho thx for the help guys |
|
|
| Report Abuse |
|
|
|
| 12 Jan 2014 07:18 AM |
| Why would the Z be any different from the X and the Y? |
|
|
| Report Abuse |
|
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
|
| 12 Jan 2014 07:19 AM |
| If it involves more than one dimension, then you use Pythagoras, otherwise it's just a simple difference between them. |
|
|
| Report Abuse |
|
|
|
| 12 Jan 2014 07:19 AM |
| thx roflbread! ill keep that in mind! |
|
|
| Report Abuse |
|
|
WebGL3D
|
  |
| Joined: 04 Sep 2013 |
| Total Posts: 28311 |
|
|
| 12 Jan 2014 07:23 AM |
local A,B = Workspace.PartA.Position,Workspace.PartB.Position local Distance = Vector3.new(0,0,math.max(A.z,B.z)-math.min(A.z,B.z)) print(Distance.z)
?
~ 1Topcop ~ Java3D ~ WebGL3D ~ Hoard3D ~ Thug3D |
|
|
| Report Abuse |
|
|
| |
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
|
| 12 Jan 2014 07:38 AM |
| Questions been answered already |
|
|
| Report Abuse |
|
|
WebGL3D
|
  |
| Joined: 04 Sep 2013 |
| Total Posts: 28311 |
|
|
| 12 Jan 2014 07:38 AM |
@Not y shud i
~ 1Topcop ~ Java3D ~ WebGL3D ~ Hoard3D ~ Thug3D |
|
|
| Report Abuse |
|
|
breuning
|
  |
| Joined: 30 Oct 2008 |
| Total Posts: 4268 |
|
|
| 12 Jan 2014 08:16 AM |
| math.sqrt(((p2.x-p1.x)^2)+((p2.y-p1.y)^2)+((p2.z-p1.z)^2)) |
|
|
| Report Abuse |
|
|
breuning
|
  |
| Joined: 30 Oct 2008 |
| Total Posts: 4268 |
|
|
| 12 Jan 2014 08:17 AM |
| or (p2.Position - p1.Position).magnitude |
|
|
| Report Abuse |
|
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
|
| 12 Jan 2014 09:00 AM |
| The question. Has been. Answered. Already. |
|
|
| Report Abuse |
|
|