Ambiera Forum

Discussions, Help and Support.

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

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

What does the vector3d.getlength() function do?


dekon_17
Registered User
Quote
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.


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

Thanks for helping out


sulbcon
Registered User
Quote
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)


Robo
Guest
Quote
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: "Int?rnational" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






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