18.3.11

Updating Aerial to Blender 2.5

Atualizando o Máquinas para o Blender 2.5

New motion script done:
Novo script de movimento feito:

## Script by Leandro Cassa
## Updated to Blender 2.5 by Andre Ortiz
## this script is to control the plane pitch, roll and movement
## also has a crash control if you break any restrictions


import GameLogic
import math
from math import *


# 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.actuators["pythonAct"]
# gets the object who owns the actuator
obj = cont.owner


## crashAngle = 80
##
## Crash Logic. It "crashes" the plane to another state.
## if (getYAngle(obj.orientation) > crashAngle or getYAngle(obj.orientation) < -crashAngle or getXAngle(obj.orientation) > crashAngle or getXAngle(obj.orientation) < -crashAngle and GameLogic.crash) :
## # plane is crashing now.
## obj.state = 1<<1
## Game Logic
## else:
## # keep the plane flying, set Z force of 9.81 on the bottom of the plane
## act.force = [act.force[0], act.force[1], 9.81]
##
## # keep the plane moving forward (engine)
## #act.setDLoc(0, 0.01, 0, 1)
## act.dLoc = [0, 0.05, 0]
##
## # turns the plane according to Y axis rotation angle
## act.dRot = [0, 0, -getYAngle(obj.orientation)/5000 ]
##
## # activate actuator
## cont.activate(act)
## #GameLogic.addActiveActuator(act,1)


EDIT: The new motion script was wrong. HG1 just updated all Aerial Machines scripts!
EDIÇÃO: O novo script de edição estava errado. HG1 acabou de atualizar todos os scripts do Máquinas Aéreas!

KUDOS to HG1! Thank you so much! Open Source Rulez!
APLAUSOS para o HG1! Muitíssimo obrigado! Programas abertos mandam!

http://blenderartists.org/forum/showthread.php?212010-Set-sound-and-split-screen-scripts-for-2.5-How-To-SOLVED

No comments:

Post a Comment