Hello everyone!
I guess some of you know about my efforts to keep 14&20 up to date. Right now I’m cleaning it, kind of restarting from scratch.
The attached .blend file print the following errors:
Blender Game Engine Started
Method getActuator(string) is deprecated, please use the actuators[string] property instead.
moveCont:32
Method getOwner() is deprecated, please use the owner property instead.
moveCont:34
Method getOrientation() is deprecated, please use the orientation property instead.
moveCont:39
Method getForce() is deprecated, please use the force and the useLocalForce properties instead.
moveCont:45
Method setForce() is deprecated, please use the force and the useLocalForce properties instead.
moveCont:45
Method setDLoc() is deprecated, please use the dLoc and the useLocalDLoc properties instead.
moveCont:48
Method setDRot() is deprecated, please use the dRot and the useLocalDRot properties instead.
moveCont:51
Method GameLogic.addActiveActuator(act, bool) is deprecated, please use controller.activate(act) or controller.deactivate(act) instead.
moveCont:54
Method setPitch() is deprecated, please use the pitch property instead.
soundCont:32
Method setState() is deprecated, please use the state property instead.
moveCont:41
Blender Game Engine Finished
Right now i have two scrips in action the MoveCont one:
import GameLogic
import math
import Blender
from Blender import Mathutils
from Blender.Mathutils import *
script by Leandro Cassa
this script is to control the plane pitch, roll and movement
also has a crash control if you break any restrictions
global variable to define if the plane should or not crash according
to the restrictions here defined
GameLogic.crash = 1
get angle in the Matrix Y axis
def getYAngle(matrix):
tempMatrix = Matrix(matrix[0], matrix[1], matrix[2])
return tempMatrix.transpose().toEuler().y
get angle in the Matrix X axis
def getXAngle(matrix):
tempMatrix = Matrix(matrix[0], matrix[1], matrix[2])
return tempMatrix.transpose().toEuler().x
get angle in the Matrix Z axis
def getZAngle(matrix):
tempMatrix = Matrix(matrix[0], matrix[1], matrix[2])
return tempMatrix.transpose().toEuler().z
cont = GameLogic.getCurrentController()
act = cont.getActuator(“pythonAct”)
gets the object who owns the actuator
obj = cont.getOwner()
crashAngle = 75
Crash Logic!
if (getYAngle(obj.getOrientation()) > crashAngle or getYAngle(obj.getOrientation()) < -crashAngle or getXAngle(obj.getOrientation()) > crashAngle or getXAngle(obj.getOrientation()) < -crashAngle and GameLogic.crash) :
# plane is crashing now, nothing you can do
obj.setState(1<<1)
Game Logic
else:
# keep the plane flying, set Z force of 9.81 on the bottom of the plane
act.setForce(act.getForce()[0], act.getForce()[1], 9.81, 0)
# keep the plane moving forward (engine)
act.setDLoc(0, 0.2, 0, 1)
# turns the plane according to Y axis rotation angle
act.setDRot(0, 0, -getYAngle(obj.getOrientation())/5000, 0)
# activate actuator
GameLogic.addActiveActuator(act,1)
And the SoundCout one:
import GameLogic
import math
import Blender
from Blender import Mathutils
from Blender.Mathutils import *
## script by Leandro Cassa
## this script is to control the plane pitch, roll and movement
## also has a crash control if you break any restrictions
# get angle in the Matrix Y axis
def getYAngle(matrix):
tempMatrix = Matrix(matrix[0], matrix[1], matrix[2])
return tempMatrix.transpose().toEuler().y
# get angle in the Matrix X axis
def getXAngle(matrix):
tempMatrix = Matrix(matrix[0], matrix[1], matrix[2])
return tempMatrix.transpose().toEuler().x
# get angle in the Matrix Z axis
def getZAngle(matrix):
tempMatrix = Matrix(matrix[0], matrix[1], matrix[2])
return tempMatrix.transpose().toEuler().z
cont = GameLogic.getCurrentController()
act = cont.getActuator("soundAct")
# gets the object who owns the actuator
obj = cont.getOwner()
act.setPitch(float(getXAngle(obj.getOrientation())/120) + 1)
# activate actuator
GameLogic.addActiveActuator(act,1)
Can anyone help me to fix this?
Thank you very much,
Ortiz
Attachments
ToonArcadePlaneB.blend (372 KB)