stop certain objects moving?

So I have a character that walks around but when he collides into objects it moves the object as well, so is there a way so that my character stops or slides past the wall without the object that it’s moving into moving at all?

Could you be a little bit more specific?


import direct.directbase.DirectStart
from direct.showbase.DirectObject import DirectObject
from pandac.PandaModules import *
from direct.interval.IntervalGlobal import LerpFunc
from pandac.PandaModules import CollisionHandlerQueue, CollisionNode, CollisionSphere, CollisionTraverser, CollisionPolygon
from panda3d.core import Point3
import sys

class GoldenTowers(object,DirectObject):
    def __init__(self):
        self.winXhalf =
        self.winYhalf =
    def man(self):

        base.cTrav = CollisionTraverser()
        self.pusher = CollisionHandlerPusher()
        = loader.loadModel('frowney'),0,0)
        cNode = CollisionNode('man')
        Cman =,0,0.5)

        speed = 25
        Forward = Vec3(0,speed*2,0)
        Back = Vec3(0,-speed,0)
        Left = Vec3(-speed,0,0)
        Right = Vec3(speed,0,0)
        Stop = Vec3(0)
        self.walk = Stop
        self.strife = Stop
        taskMgr.add(self.move, 'move-task')

        # note: I copied this exactly from this link '
        self.accept( "escape",sys.exit )
        self.accept( "s" , self.__setattr__,["walk",Back] )
        self.accept( "w" , self.__setattr__,["walk",Forward])
        self.accept( "s-up" , self.__setattr__,["walk",Stop] )
        self.accept( "w-up" , self.__setattr__,["walk",Stop] )
        self.accept( "a" , self.__setattr__,["strife",Left])
        self.accept( "d" , self.__setattr__,["strife",Right] )
        self.accept( "a-up" , self.__setattr__,["strife",Stop] )
        self.accept( "d-up" , self.__setattr__,["strife",Stop] )
        self.pusher.addCollider(self.Csmiley, self.smiley,
        base.cTrav.addCollider(self.Csmiley, self.pusher)
        self.pusher.addCollider(self.Cfrowney, self.frowney)
        base.cTrav.addCollider(self.Cfrowney, self.pusher)

        # move function. note: I copied this exactly from this link '
    def move(self,task):
        # mouse
        md =
        x = md.getX()
        y = md.getY()
        if, self.winXhalf, self.winYhalf):
  , (x - self.winXhalf)*-0.1)
   clampScalar(-90,90, - (y - self.winYhalf)*0.1) )
        # move where the keys set it
        moveVec=(self.walk+self.strife)*dt # horizontal,moveVec)
        return task.cont

        # create 'smiley'
    def smiley(self):
        self.smiley = loader.loadModel('smiley')
        self.Cnode = CollisionNode('smiley')
        self.Csmiley = self.smiley.attachNewNode(self.Cnode)

        # create 'frowney'
    def frowney (self):
        self.frowney = loader.loadModel('frowney')
        self.Cnode = CollisionNode ('frowney')
        self.Cfrowney = self.frowney.attachNewNode(self.Cnode)


if you execute this code you will notice that when you run into ‘frowney’ or ‘smiley’ that they will move, so what I want is that ‘frowney’ and ‘smiley’ don’t move when I hit them and ‘man’ just slides past. (if that makes sense)

Which character moves when colliding?
The character you’re controlling? Or something else?

Both objects move (the one I’m controlling and smiley) and I want it so that smiley doesn’t move and when they collide man, (the one I’m controlling) just stops or slides past (like if it was a solid wall) with out smiley moving around as if man is pushing it.

Based on a quick look, I suspect that your problem is that you’re adding the “smiley” and “frowney” to your pusher.

As indicated in the manual, divide your objects into “from” objects and “into” objects: objects that cause collisions and objects that are collided with. Which are which depends, I daresay, on your situation (in general, I believe: attempt to reduce the number of “from” objects in order reduce the performance cost of collision), but in this case, since you want “man” to be pushed and “smiley” and “frowney” to be static, I recommend that “man” be a “from” object and “smiley” and “frowney” be “into” objects.

In short, don’t add either “smiley” or “frowney” to either your traverser or pusher, I believe.

For a more detailed explanation, take a look at this manual page.

Thanks you were absolutely right I just removed ‘frowney’ and ‘smiley’ and added ‘man’ and everything was fine.