Module: Movable3

Included in:
Camera3, Cursor3
Defined in:
lib/moon/packages/twod/movable3.rb

Instance Method Summary collapse

Instance Method Details

#backward(d = 1.0) ⇒ Object


23
24
25
# File 'lib/moon/packages/twod/movable3.rb', line 23

def backward(d = 1.0)
  moveto(position + Moon::Vector3.new(0.0, -move_distance * d, 0.0))
end

#down(d = 1.0) ⇒ Object


15
16
17
# File 'lib/moon/packages/twod/movable3.rb', line 15

def down(d = 1.0)
  moveto(position + Moon::Vector3.new(0.0, 0.0, -move_distance * d))
end

#forward(d = 1.0) ⇒ Object


19
20
21
# File 'lib/moon/packages/twod/movable3.rb', line 19

def forward(d = 1.0)
  moveto(position + Moon::Vector3.new(0.0, move_distance * d, 0.0))
end

#left(d = 1.0) ⇒ Object


27
28
29
# File 'lib/moon/packages/twod/movable3.rb', line 27

def left(d = 1.0)
  moveto(position + Moon::Vector3.new(-move_distance * d, 0.0, 0.0))
end

#move_distanceObject


2
3
4
# File 'lib/moon/packages/twod/movable3.rb', line 2

def move_distance
  1
end

#moveto(*args) ⇒ Object


6
7
8
9
# File 'lib/moon/packages/twod/movable3.rb', line 6

def moveto(*args)
  self.position = Moon::Vector3[*args]
  self
end

#right(d = 1.0) ⇒ Object


31
32
33
# File 'lib/moon/packages/twod/movable3.rb', line 31

def right(d = 1.0)
  moveto(position + Moon::Vector3.new(move_distance * d, 0.0, 0.0))
end

#up(d = 1.0) ⇒ Object


11
12
13
# File 'lib/moon/packages/twod/movable3.rb', line 11

def up(d = 1.0)
  moveto(position + Moon::Vector3.new(0.0, 0.0, move_distance * d))
end