I am not denying that I am a newbie with blender...so I need some help. I do have lite programming experience but in other languages and not python.
I am working on a mouselook script from a tutorial that I was trying to follow along with. My goal is to get the mouselook working with a wsad script that I figured out.
I have 2 issues
1. When I get the mouselook working what is the best way to combine it with the wsad script.
2. I am getting an error in my system console that says "Pyton controller found the module but could not access the function - object 'eyes, controller 'python': AttributeError: 'module' object has no attribute 'py'
I was going to try to insert an image of my logic bricks by can't understand how to do it her.
My code for the mouselook that I am having problems with is below.
Code: Select all
from bge import logic, render class MouseLook: def __init__(self, cont): self.cont = cont self.sen_mouse = self.cont.sensors["mouse"] self.act_rotx = self.cont.actuators["rotx"] self.act_rotz = self.cont.actuators["rotz"] self.cont.activate(self.act_rotx) self.cont.activate(self.act_rotz) x = render.getWindowWidth()//2 y = render.getWindowHeight()//2 self.screen_center = (x, y) def getMouseOffset(self): vec_screencenter = Vector(self.screen_center) vec_mouseposition = Vector(self.sen_mouse.position) return vec_mouseposition - vec_screencenter def main(self): vec_offset = self.getMouseOffset() self.act_rotx.dRot = [vec_offset.y, 0, 0] self.act_rotz.dRot = [0, 0, vec_offset.x] render.setMousePosition(*self.screen_center) mouse_look = MouseLook(logic.getCurrentController()) def main(): mouse_look.main()