Game Object: getAxisVect

getAxisVect(worldVec)
  • Returns the alignment of the Game Object's x-axis and y-axis and z-axis to a World vector.

Return Type:

  • List [ vx, vy ,vz]
  • vx = cosine of the angle of the game object's x-axis to the worldVec
  • vy = cosine of the angle of the game object's y-axis to the worldVec
  • vz = cosine of the angle of the game object's z-axis to the worldVec

worldVec:

  • Vector created using the world axis
     
  • Type:  List [ worldX, worldY, worldZ]
  • worldX = cosine of the vector angle to the world x-axis
  • worldY = cosine of the vector angle to the world y-axis
  • worldZ = cosine of the vector angle to the world z-axis
Sample Code

################## get the alignment of the game object to a World vector
  

# import bge
import bge

# get controller
cont = bge.logic.getCurrentController()

# get object that controller is attached to
obj = cont.owner

# use the World X-axis as the the world vector
worldVec = [1.0, 0.0, 0.0]

# get game object alignment to the worldVec
vect = obj.getAxisVect( worldVec)