Forged Alliance Forever Forged Alliance Forever Forums 2014-01-14T21:36:04+02:00 /feed.php?f=45&t=6279 2014-01-14T21:36:04+02:00 2014-01-14T21:36:04+02:00 /viewtopic.php?t=6279&p=61973#p61973 <![CDATA[Re: Zooming into a planet using search in GW]]>
And your code is at best a workaround. The look at computation is necessary because of the camera tilt. If you don''t do it, you have to enter manually some offset.
- That will not work all the time.
- It will break as soon as anything change map-wise.

Statistics: Posted by Ze_PilOt — 14 Jan 2014, 21:36


]]>
2014-01-14T19:28:44+02:00 2014-01-14T19:28:44+02:00 /viewtopic.php?t=6279&p=61960#p61960 <![CDATA[Zooming into a planet using search in GW]]>
so i tried doing it : D


here is the gotoplanet function in glDisplay.py which looks like its responsible for creating a vector between the camera position and where it should be and moving it there.



Code:
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()

i just downloaded the source and started looking at files in notepad, and came across this function, which i changed a bit to make the destination of the camera further away from the planet (hopefully)

i wasn't sure why there was a complicated calculation for the y coordinate for the camera to look at, but maybe it doesn't matter :/

i think that an alternative way to do this would be to simply change the zoomMax variable from 70 to 220 but this will affect other things as well (like that strange ir variable, which will be slightly smaller)

i think that this is all that needs to be changed
but i dont know anything about python or programming or anything that might be useful for this, so if i was deeply (or otherwise) mistaken, i guess il just shut up on this topic :)

if im right and this works i can do all the official things and get this implemented into the lobby if zep lets me, or he could just add the 3 line change manually or something

anyone's welcome welcome to criticize this of course : )

Statistics: Posted by Exotic_Retard — 14 Jan 2014, 19:28


]]>