![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | PtrMan |
I defined a custom class like so and want to construct it from the same file:
var x = 0.0
var y = 0.0
var z = 0.0
func _init(x_,y_,z_):
self.x = x_
self.y = y_
self.z = z_
static func dot(a, b):
return a.x*b.x + a.y*b.y + a.z*b.z
static func length(a):
return sqrt(dot(a,a))
static func scale(a,s):
return _init(a.x*s,a.y*s,a.z*s) # doesn't work, how to do this?