def render(self, camposx=None, camposy=None, camposz=None, camang=None): #, camortx=None, camorty=None, camortz=None, camortw=None): cament = naali.getCamera() p = cament.placeable if camposx is not None: pos = Vec(*(float(v) for v in [camposx, camposy, camposz])) p.Position = pos if camang is not None: ort = p.Orientation start = Quat(0, 0, -0.707, -0.707) rot = Quat.fromAxisAndAngle(Vec(0, 1, 0), -float(camang)) new = start * rot p.Orientation = new #if camortx is not None: # ort = Quat(*(float(v) for v in [camortw, camortx, camorty, camortz])) # p.Orientation = ort #return str(p.Position), str(p.Orientation) #self.render1() baseurl, imgname = save_screenshot() imgurl = baseurl + imgname pos = p.Position ort = p.Orientation #vec, ang = toAngleAxis(p.Orientation) #print vec, ang euler = quat_to_euler([ort.scalar(), ort.x(), ort.y(), ort.z()]) ang = euler[0] if ang < 0: ang = 360 + ang return abshtml % (imgurl, ang, pos.x(), pos.y(), pos.z() #ort.scalar(), ort.x(), ort.y(), ort.z(), )
def render(self, camposx=None, camposy=None, camposz=None, camang=None): #, camortx=None, camorty=None, camortz=None, camortw=None): cament = naali.getCamera() p = cament.placeable if camposx is not None: pos = Vec(*(float(v) for v in [camposx, camposy, camposz])) p.Position = pos if camang is not None: ort = p.Orientation start = Quat(0, 0, -0.707, -0.707) rot = Quat.fromAxisAndAngle(Vec(0, 1, 0), -float(camang)) new = start * rot p.Orientation = new #if camortx is not None: # ort = Quat(*(float(v) for v in [camortw, camortx, camorty, camortz])) # p.Orientation = ort #return str(p.Position), str(p.Orientation) #self.render1() baseurl, imgname = save_screenshot() imgurl = baseurl + imgname pos = p.Position ort = p.Orientation #vec, ang = toAngleAxis(p.Orientation) #print vec, ang euler = quat_to_euler([ort.scalar(), ort.x(), ort.y(), ort.z()]) ang = euler[0] if ang < 0: ang = 360 + ang return abshtml % ( imgurl, ang, pos.x(), pos.y(), pos.z() #ort.scalar(), ort.x(), ort.y(), ort.z(), )
ang = 2.0 * math.acos(quat.scalar()) invlen = lensq ** 0.5 vec = PythonQt.QtGui.QVector3D(quat.x() * invlen, quat.y() * invlen, quat.z() * invlen) return vec, ang cament = naali.getCamera() p = cament.placeable #print toAngleAxis(p.Orientation) ort = p.Orientation euler = quat_to_euler([ort.scalar(), ort.x(), ort.y(), ort.z()]) print euler start = Quat(0, 0, -0.707, -0.707) #print start rot = Quat.fromAxisAndAngle(Vec(0, 1, 0), -10) #euler[0]) new = start * rot #print euler_to_quat(euler) print ort print new #p.Orientation = new #print euler_to_quat(euler), ort if 0: #avatar set yaw (turn) #a = -1.0 a = 0 print "setting avatar yaw with %f" % a
ang = 2.0 * math.acos(quat.scalar()) invlen = lensq**0.5 vec = PythonQt.QtGui.QVector3D(quat.x() * invlen, quat.y() * invlen, quat.z() * invlen) return vec, ang cament = naali.getCamera() p = cament.placeable #print toAngleAxis(p.Orientation) ort = p.Orientation euler = quat_to_euler([ort.scalar(), ort.x(), ort.y(), ort.z()]) print euler start = Quat(0, 0, -0.707, -0.707) #print start rot = Quat.fromAxisAndAngle(Vec(0, 1, 0), -10) #euler[0]) new = start * rot #print euler_to_quat(euler) print ort print new #p.Orientation = new #print euler_to_quat(euler), ort if 0: #avatar set yaw (turn) #a = -1.0 a = 0 print "setting avatar yaw with %f" % a