Statistics: Posted by Ze_PilOt — 14 Jan 2014, 21:36
def gotoPlanet(self, uid):
if not uid in self.galaxy.control_points:return
if not self.galaxy.control_points[uid].isVisible():return
self.timerRotate.stop()
self.animCam.stop()
self.animCamMove.stop()
x = self.galaxy.control_points[uid].x
y = self.galaxy.control_points[uid].y
self.destination = QtGui.QVector3D(x,y,self.zoomMax + 150)
# here i have added 150 to the x value of the destination, which seems to be the planet coordinates and the maximum zoom in height.
# compute camera deviation
ir = 1.0 - (self.zoomMax)/ (self.zoomMin - (self.zoomMax))
lookat = QtGui.QVector3D(self.destination.x(), self.destination.y(), self.destination.z())
# but to look at the planet and not 150 above it i took away 150 from the z coordinate here
lookat.setZ(lookat.z() - 151.0)
lookat.setY(lookat.y() + pow(ir, 5.0))
# i don't know what this does but it seems to add ~0.9 to the y value for some reason, to make it look slightly above/behind the planet?
inter = self.rayPlaneIntersect(self.destination, self.destination-lookat, QtGui.QVector3D(0,0,0),QtGui.QVector3D(0,0,1))
self.destination.setY(self.destination.y() - inter.y())
self.camOriginPos = QtGui.QVector3D(self.cameraPos.x(),self.cameraPos.y(), self.cameraPos.z())
self.vectorMove = QtGui.QVector3D(self.destination.x() - self.cameraPos.x(), self.destination.y() - self.cameraPos.y(), (self.destination.z() -self.cameraPos.z()) )
self.animCamMove.start()
Statistics: Posted by Exotic_Retard — 14 Jan 2014, 19:28