Class: Ogre::SceneNode

Inherits:
Object show all
Defined in:
lib/shattered_view/ogrerb/scene_node.rb

Instance Method Summary collapse

Instance Method Details

#look_at(*args) ⇒ Object

Look at an object This function is different than the one in the Ogre SDK because it defaults to TS_LOCAL as the transform space You can send it a node, mesh, or anything with a position vector Or just a vector



45
46
47
48
49
50
51
# File 'lib/shattered_view/ogrerb/scene_node.rb', line 45

def look_at(*args)
	transform = Ogre::Node::TS_LOCAL
	transform = args[1] if(args.length == 2)		
	v = args[0]
	v = args[0].position if args[0].class.respond_to? :position
	raw_look_at v, transform
end

#raw_look_atObject



38
# File 'lib/shattered_view/ogrerb/scene_node.rb', line 38

alias_method :raw_look_at, :look_at

#raw_rotateObject



27
# File 'lib/shattered_view/ogrerb/scene_node.rb', line 27

alias_method :raw_rotate, :rotate

#raw_scaleObject



63
# File 'lib/shattered_view/ogrerb/scene_node.rb', line 63

alias_method :raw_scale, :scale

#rotate(axis, amount, *args) ⇒ Object

rotate works in degrees by default, and in the TS_lOCAL space



30
31
32
33
34
35
36
# File 'lib/shattered_view/ogrerb/scene_node.rb', line 30

def rotate(axis, amount, *args)
	if(args.empty?)
	  raw_rotate(axis.to_v, Radian.new(Degree.new(amount)))
	else
		raw_rotate(axis.to_v, Radian.new(Degree.new(amount)), args[0])
	end
end

#scale(*args) ⇒ Object

scale works with numbers, vectors, or 3 numbers and is relative



66
67
68
69
70
71
72
73
74
# File 'lib/shattered_view/ogrerb/scene_node.rb', line 66

def scale(*args)
	return get_scale if args.length == 0
	v = args
	
	# This handles calling scale=0.5 or some other number
	v = v(v[0], v[0], v[0]) if v[0].is_a? Numeric
	
	raw_scale(*v)
end

#scale=(*args) ⇒ Object

scale= works with numbers, vectors, or 3 numbers and is absolute



54
55
56
57
58
59
60
61
# File 'lib/shattered_view/ogrerb/scene_node.rb', line 54

def scale=(*args)
	v = args
	
	# This handles calling scale=0.5 or some other number
	v = v(v[0], v[0], v[0]) if v[0].is_a? Numeric
	
	set_scale(*v)
end