Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #CONSTRAINT
- direction = cont.actuators['Direction'] #the constraint actuator
- face = sce.objects['Facer'] #the facing object
- faco = face.localOrientation[1] #here we are (this gives me a 3x3 matrix)
- #but i only want to use the Y value
- #I’ve tried out even 0, and 2 but wont work
- def constra():
- direction.direction = faco #this isn't running as it should
- cont.activate(direction)
- import bge
- import mathutils
- sce = bge.logic.getCurrentScene()
- face = sce.objects['Facer']
- facY = face.worldOrientation.to_euler()[1] #Now we have the Y-axis rotation
- facTar = sce.objects['Facingtarget'] #This is the target object we modify
- newRotList = [facTar.worldOrientation.to_euler()[0],facY,facTar.worldOrientation.to_euler()[2]] #Now we have a list
- newRot = mathutils.Euler(newRotList).to_matrix() #Now we have the matrix we need
- facTar.worldOrientation = newRot #The orientation has been modified
Add Comment
Please, Sign In to add comment