awas3
|
  |
| Joined: 24 Oct 2010 |
| Total Posts: 2854 |
|
|
| 25 Jun 2012 03:01 PM |
| How would you use magnitude in scripting? |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 25 Jun 2012 03:03 PM |
function distanceBetween(a,b) return (a.Position-b.Position).magnitude end
print(distanceBetween(workspace.nate890.Torso,workspace.SpawnLocation)) |
|
|
| Report Abuse |
|
|
su8
|
  |
| Joined: 06 Mar 2009 |
| Total Posts: 6334 |
|
|
| 25 Jun 2012 03:04 PM |
| And you should try to avoid using magnitude :PP |
|
|
| Report Abuse |
|
|
|
| 25 Jun 2012 03:05 PM |
| Why would you avoid using magnitude? :l |
|
|
| Report Abuse |
|
|
awas3
|
  |
| Joined: 24 Oct 2010 |
| Total Posts: 2854 |
|
|
| 25 Jun 2012 03:06 PM |
| I want to make an automatic door :p |
|
|
| Report Abuse |
|
|
su8
|
  |
| Joined: 06 Mar 2009 |
| Total Posts: 6334 |
|
|
| 25 Jun 2012 03:19 PM |
>Why would you avoid using magnitude? :l
Calculating magnitude is slow. |
|
|
| Report Abuse |
|
|
|
| 25 Jun 2012 03:20 PM |
| I'm pretty sure that any time you create a vector3 object, roblox pre-calculates magnitude. Not to mention that many square roots are held in memory to make calculations like this easier. |
|
|
| Report Abuse |
|
|
su8
|
  |
| Joined: 06 Mar 2009 |
| Total Posts: 6334 |
|
| |
|
|
| 25 Jun 2012 03:25 PM |
| I prefer cubes rather than circles :P |
|
|
| Report Abuse |
|
|
awas3
|
  |
| Joined: 24 Oct 2010 |
| Total Posts: 2854 |
|
| |
|