Is there a setting somewhere that can be set to prevent an AICharacter from rotating as it flees or evades?
You should understand that there is a regular node under the hood of the AI. Now imagine what you would do if you didn’t need orientation?
I suggest just creating a task that will update only the position of your model with the AI node. At the same time, you can use an empty node for the AI system.
from direct.showbase.ShowBase import ShowBase
from panda3d.core import NodePath
from direct.task import Task
from panda3d.ai import AIWorld, AICharacter
from direct.actor.Actor import Actor
class World(ShowBase):
def __init__(self):
ShowBase.__init__(self)
base.disableMouse()
base.cam.setPosHpr(0,0,55,0,-90,0)
self.ai = NodePath("ai")
# Seeker
self.model = Actor("models/panda-model",
{"walk": "models/panda-walk4"})
self.model.reparentTo(render)
self.model.setScale(0.005)
self.model.loop("run")
#Creating AI World
self.AIworld = AIWorld(render)
self.AIchar = AICharacter("model", self.ai, 100, 0.05, 5)
self.AIworld.addAiChar(self.AIchar)
self.AIbehaviors = self.AIchar.getAiBehaviors()
self.AIbehaviors.wander(5, 0, 10, 1.0)
#AI World update
taskMgr.add(self.AIUpdate,"AIUpdate")
#to update the AIWorld
def AIUpdate(self,task):
self.model.setPos(self.ai.getPos())
self.AIworld.update()
return Task.cont
w = World()
w.run()
Thanks, I figured you would need to do it like this.
It is useful for such things like a ship dodging debris while shooting in a locked direction.