I'm making a 3D Pacman game using BGE. I have an action actuator that plays the Pacman mouth animation. That works, but when I add the Motion Actuator for the player to rotate the character, everything moves fine, except the mouth. If I remove the action actuator, the whole character rotates, but the mouth is always closed.

Game Logic Here's the link to the .blend file

I tried looking for similar problems online for about 2 or 3 hours and found nothing.

Thanks in advance


1 Answer 1


Found an answer that fits my needs. I made this Python script that stops the action actuator, rotates to the desired position and then plays the animation again. I also added an always sensor to keep pacman moving on the direction defined by the "direcao" property.

from bge import logic
import math
controller = logic.getCurrentController()
own = controller.owner

name = "AnimaBocaAcao"
start = 1.0
end = 24.0
layer = 0
priority = 1
blendin = 1.0
mode = logic.KX_ACTION_MODE_LOOP
layerWeight = 0.0
ipoFlags = 0
speed = 1.0

sensors = own.sensors

if own["direcao"] == "dir":
elif own["direcao"] == "esq":
elif own["direcao"] == "cima":

if sensors["W"].positive:
    currentOrientation = [0, 0, math.radians(90)]
    own["direcao"] = "cima"
if sensors["S"].positive:
    currentOrientation = [0, 0, math.radians(270)]
    own["direcao"] = "baixo"
if sensors["A"].positive:
    currentOrientation = [0, 0, math.radians(180)]
    own["direcao"] = "esq"
if sensors["D"].positive:
    currentOrientation = [0, 0, 0]
    own["direcao"] = "dir"

own.localOrientation = currentOrientation
own.playAction(name, start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)

Game Logic


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.