AttributeError: KX_GameObject.worldLinearVelocity is missing a physics controller
This module stops running when it meets the "cam.worldLinearVelocity" command keys. It used to run before I parent the camera to an empty and the empty to the vertices of a cube.
In the lines where the error occurs I changed the camera speed so the camera would move accordingly when the mouse cursor would be near the edges of the screen.
Below are 2 pictures to clear things a bit and the module itself.
(even if I change the empty and the cube player into dynamic or static nothing changed, same error)
import bge
bge.render.showMouse(True)
scene = bge.logic.getCurrentScene()
cont = bge.logic.getCurrentController()
sens_wh_up = cont.sensors["wh_up"]
sens_wh_down = cont.sensors["wh_down"]
cam = scene.active_camera
mousePos = bge.logic.mouse.position
mX = max(0.0,min(1.0,mousePos[0]))
mY = max(0.0,min(1.0,mousePos[1]))
if mX < 0.05:
cam.worldLinearVelocity.x = -5*(2-mX)
cam.worldLinearVelocity.y = (0.5-mY)*5
elif mX > 0.95:
cam.worldLinearVelocity.x = 5*(2+mX)
cam.worldLinearVelocity.y = (0.5-mY)*5
if mY < 0.05:
cam.worldLinearVelocity.y = 5*(2+mY)
cam.worldLinearVelocity.x = -(0.5-mX)*5
elif mY > 0.95:
cam.worldLinearVelocity.y = -5*(2-mY)
cam.worldLinearVelocity.x = -(0.5-mX)*5
cam.worldLinearVelocity *= 0.9
if (sens_wh_up.positive):
cam.ortho_scale = cam.ortho_scale+5
if (sens_wh_down.positive):
cam.ortho_scale = cam.ortho_scale-5
What am I doing wrong? What exactly is the physics controller that I am missing?
cam.setLinearVelocity()
no errors but no success $\endgroup$