Exemplo n.º 1
0
	def rotationMatrix(self):
		w = self.target.normalize()
		u = Vector3.cross(Vector3.up().normalize(), w)
		v = Vector3.cross(w, u)
		rotMat = np.matrix([[u.x, u.y, u.z, 0.0],
				  		[v.x, v.y, v.z, 0.0],   
						[w.x, w.y, w.z, 0.0 ],
						[0.0, 0.0, 0.0, 1.0]], dtype=np.float32)
		return rotMat
Exemplo n.º 2
0
	def mouseMove(self, x, y):
		newMouse = Vector2(x, y)
		delta = (newMouse - self.mouse).normalize()
		self.mouse = newMouse
		if delta.x > 0:
			self.camera.position -= Vector3.cross(self.camera.up.normalize(),self.camera.target.normalize()) * delta.x * self.PAN_MOVE
		else:
			self.camera.position += Vector3.cross(self.camera.up.normalize(),self.camera.target.normalize()) * abs(delta.x) * self.PAN_MOVE
		if delta.y < 0:
			self.camera.position -= self.camera.up.normalize() * abs(delta.y) * self.PAN_MOVE
		else:
			self.camera.position += self.camera.up.normalize() * delta.y *self.PAN_MOVE
				
		print delta