Thanks for the reply.
I have myself been trying the different types of controls I could give to the player, though due to lack of time, I did not go through all the possibilities…
For the game I am making, here is the Mouse.py file I devised for mouse control.
from pandac.PandaModules import CollisionTraverser,CollisionNode
from pandac.PandaModules import CollisionHandlerQueue,CollisionRay
from pandac.PandaModules import Filename
from pandac.PandaModules import PandaNode,NodePath,Camera,TextNode
from pandac.PandaModules import Vec3,Vec4,BitMask32
from direct.gui.OnscreenText import OnscreenText
from direct.actor.Actor import Actor
from direct.task.Task import Task
from direct.showbase.DirectObject import DirectObject
from pandac.PandaModules import WindowProperties
import random, sys, os, math, platform
self.heading = 180
s = platform.system()
windows = (s == 'Windows') or (s == 'Microsoft')
freebsd = (s == 'FreeBSD')
linux = (s == 'Linux')
osx = (s == 'Darwin')
unix = freebsd or linux or osx
if self.mouseControl and base.mouseWatcherNode.hasMouse():
mpos = base.mouseWatcherNode.getMouse()
if (self.py < -50): self.py = -50
self.justOpened = not self.justOpened
x = base.win.getPointer(0).getX()
y = base.win.getPointer(0).getY()
if base.win.movePointer(0, base.win.getXSize()/2, base.win.getYSize()/2):
self.heading = self.heading - (x - base.win.getXSize()/2)*0.2
self.pitch = self.pitch - (y - base.win.getYSize()/2)*0.2
if (self.pitch < -50): self.pitch = -50 #up movement i.e, how much down you can see
if (self.pitch > 5): self.pitch = 5 #down movement i.e, how much up you can see
You will notice that I put the player’s initial direction, I was actually hoping to add some more features whereby the player could lock his view on a certain opponent during combat but did not get the time to complete it.
you will notice that the moveLinux function doesn’t do what I intended to do, maybe i could replace it with lethe’s solution.
Anyway, for the problem you are saying coming from X, well during my study of the different Engines, I tried CrystalSpace3D and the binary it provides, CELStart. I tried it with a sample from their website, the castle.celzip file, and the mouse control over there is what I was expecting. And its totally smooth over there. So i tried to see how it was moving the mouse simply by alt-tabbing to another windows, and guess what? I saw my cursor each time being brought to the centre of the screen just like the moveWindows task does in my class. So how is it working without any problem over there but we are having difficulties here. Maybe we could see how they implemented the mouse control in that engine, considering its open source too, so that should not be a problem…
Thanks for your help guys, its good to know there are others working in a Linux environment with panda3D(my project partner always pesters me on moving to windows ).