Method: BulldogPhysics::Vector3#normalize

Defined in:
lib/vector3.rb

#normalizeObject

Turns a non-zero vector into a vector of unit length.



33
34
35
36
37
38
39
40
# File 'lib/vector3.rb', line 33

def normalize
  length = self.magnitude
  if length > 0
    @x *= (1.0/length)
    @y *= (1.0/length)
    @z *= (1.0/length)
  end
end