Dot product (vector * vector) returns a vector, not a float (undocumented departure from LSL semantics)
planned
LiamHoffen Resident
The SLua code below demonstrates the problem. Two vectors, multiplied, results in a vector answer rather than a number.
v1 = vector(9, 2, 7)
v2 = vector(4,8,10)
v3 = v1 * v2
ll.OwnerSay(typeof(v3) .. ": " .. tostring(v3))
Program output:
vector: <36.00000, 16.00000, 70.00000>
Reason for identifying as a bug:
The SL Wiki indicates that the dot product should return the sum of the products of the vector elements.
In this case, the expected result should be 122.0.
What is returned instead is simply the vector of the products of each element.
Log In
H
Harold Linden
planned
This is the intended behavior, but is a departure from LSL. LSL didn't have a great way to scale vectors even though that's probably the more commonly desired and expected operation.
vector.dot(vec1, vec2)
is how you get the dot product under SLua, but there's a documentation deficiency there currently.