Team Spartan Cookies & Milk Forums
Vector methods - Printable Version

+- Team Spartan Cookies & Milk Forums (https://teamscm.co.uk)
+-- Forum: Garry's Mod (https://teamscm.co.uk/forum-4.html)
+--- Forum: Starfall (https://teamscm.co.uk/forum-7.html)
+--- Thread: Vector methods (/thread-3465.html)



Vector methods - The17thDoctor - 04-10-2020

Is there any way to add methods to the vector class such as Vector:__div(vector) ( Dividing x/x2 & y/y2 & z/z2 )


RE: Vector methods - Person8880 - 05-10-2020

Dividing vectors in that way doesn't make much sense, which is why no such method exists.

What is the use case for wanting it? If it's scaling, I could add Vector:Scale() and Vector:InverseScale() methods to do component-wise multiplication and division respectively, though you can already use a VMatrix to do this.


RE: Vector methods - The17thDoctor - 05-10-2020

My original use was to calculate the size of a prop's new bounding box relative to its original size ( So I wanted to do new_size/original_size and it'd give me a vector scale ) But I solved that yesterday.