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
 

Magnitude

Previous Thread :: Next Thread 
YourNeverSafe is not online. YourNeverSafe
Joined: 30 Dec 2011
Total Posts: 462
16 Jan 2012 07:14 PM
Why won't this work?
Output: magnitude is not a valid member, did you forget to capitalize the first letter?

if (Main.Position - v.Position).magnitude > Distance then
Report Abuse
blueymaddog is not online. blueymaddog
Joined: 23 Sep 2009
Total Posts: 5459
16 Jan 2012 07:26 PM
are they bothe Vector3 position? if not then i wont work...
Report Abuse
TwoBoo is not online. TwoBoo
Joined: 08 Feb 2011
Total Posts: 10790
16 Jan 2012 07:28 PM
The output said that?? o.e
Report Abuse
YourNeverSafe is not online. YourNeverSafe
Joined: 30 Dec 2011
Total Posts: 462
16 Jan 2012 07:28 PM
"Vector3 position"

That gave me the answer,
as they are GUIs I must use Vector2.new().

Weird error though.
Report Abuse
YourNeverSafe is not online. YourNeverSafe
Joined: 30 Dec 2011
Total Posts: 462
16 Jan 2012 07:29 PM
@Boo

Yup,
UFAIL2 told me about that error,
but I wasn't paying much attention. :c
Report Abuse
blueymaddog is not online. blueymaddog
Joined: 23 Sep 2009
Total Posts: 5459
16 Jan 2012 07:31 PM
just use a custom magnitude function (i belive this is right, correct me if im wrong):

function mag(v1,v2)
return sqrt(v1.x*v2.x+v1.y*v2.y+v1.z*v2.z)
end
Report Abuse
blueymaddog is not online. blueymaddog
Joined: 23 Sep 2009
Total Posts: 5459
16 Jan 2012 07:32 PM
sorry, i made a huge mistake:

function mag(v)
return sqrt(v.x^2+v.y^2+v.z^2)
end
Report Abuse
YourNeverSafe is not online. YourNeverSafe
Joined: 30 Dec 2011
Total Posts: 462
16 Jan 2012 07:33 PM
I'm good with math,
but too many numbers;
I can't follow D:

I'd rather use built-in functions,
though that is more impressive.
Report Abuse
blueymaddog is not online. blueymaddog
Joined: 23 Sep 2009
Total Posts: 5459
16 Jan 2012 07:37 PM
does it work?
Report Abuse
18cwatford is not online. 18cwatford
Joined: 08 Oct 2009
Total Posts: 5410
16 Jan 2012 07:38 PM
if => then?
Report Abuse
YourNeverSafe is not online. YourNeverSafe
Joined: 30 Dec 2011
Total Posts: 462
16 Jan 2012 07:39 PM
You are a better coder then me,
so I'm guessing yes.
Report Abuse
blueymaddog is not online. blueymaddog
Joined: 23 Sep 2009
Total Posts: 5459
16 Jan 2012 07:47 PM
I think you need a special magnitude function for Vector2, they might not have it (localscript needed i think):

function v2mag(v)
return sqrt(v.AbsolutePosition.x^2+v.AbsolutePosition.y^2)
end
Report Abuse
blockoo is not online. blockoo
Joined: 08 Nov 2007
Total Posts: 17202
16 Jan 2012 07:48 PM
lolnoobs

Everyone knows magnitude works for Vector2's as well.
Report Abuse
blockoo is not online. blockoo
Joined: 08 Nov 2007
Total Posts: 17202
16 Jan 2012 07:49 PM
Proof:

http://wiki.roblox.com/index.php/Vector2
Report Abuse
blueymaddog is not online. blueymaddog
Joined: 23 Sep 2009
Total Posts: 5459
16 Jan 2012 07:50 PM
I never to bother actually checking wiki T_T
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