[Lua] how to copy a Vector3?


how to copy a Vector3 ?
When doing the following :

hg = require("harfang")
vec1 = hg.Vector3(0,0,0)
vec2 = vec1
vec1.x = 10

the ouput is : 10

any idea how to get a copy of an HARFANG object, rather than a reference ?


Hi !

In order to get a copy of a Vector3 instead of a reference do the following :

vec2 = hg.Vector3(vec1)

'hope this helps :slight_smile: