Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Programming and Scripting
Vector 3d class?

Registered User
2022-04-04 12:05:09

What does the vector3d.getlength() function do?

Registered User
2022-04-06 09:56:08

Well, according to documentation, it is the command that calculates length of a vector. To use this command, the variable (or something like that) should be vector3d as well. So, you can't just take positions of nodes and work with it (just for example), commands like getLength or others are only suited for vector3d... Class, if that's how it is called?

Don't know if that helps you, I just have no idea how to explain this.

Registered User
2022-04-06 11:18:50

Thanks for helping out

Registered User
2022-04-06 11:24:07

Well I did a little bit of a research and found out that it is the magnitude (i.e the hypotenus of the vector using the x,y,z co-ordinates)

2022-04-08 03:34:44

Yes, the hypotenus or straight line distance will be the result of using ".getLength();"

Normally you want the distance between 2 objects so just get both positions and then substract them first for a vector3d difference before using ".getLength".

Once subtracted you could also use the ".normalize();" function to get a base x,y,z amount difference to then multiple by some set amount - ie as is used in the Drag n Drop Behavior or picking up an object and seeing it come towards the player for example..

Create reply:

Posted by: (you are not logged in)

Enter the missing letter in: "?nternational" (you are not logged in)




Possible Codes

Feature Code
Link [url] [/url]
Bold [b]bold text[/b]
Image [img][/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]



Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact