Rubber Banding - Collisions

Hello again, I’ve been progressing slowly with my collisions. I have a CollsionSphere set up around my walking piggy - and a plane that stretches upwards to form a wall, however, when my piggy walks into it - it sort of bounces backwards, and then goes through the wall. Even more unhelpful is the fact that my piggy Actor and it’s CollisionSphere displace - and end up seperated.

Any help is much appreciated as always, cheers.

import direct.directbase.DirectStart
from direct.showbase.DirectObject import DirectObject
from direct.task.Task import Task
from direct.actor import Actor
import random, sys, os, math
from pandac.PandaModules import *
from direct.gui.OnscreenText import OnscreenText
from pandac.PandaModules import CollisionTraverser,CollisionNode
from pandac.PandaModules import CollisionHandlerQueue,CollisionRay
from direct.interval.IntervalGlobal import *

base.cTrav = CollisionTraverser()
pusher = CollisionHandlerPusher()

# Function to put title on the screen.
def addTitle(text):
    return OnscreenText(text=text, style=1, fg=(1,1,1,1),
                   pos=(1.3,-0.95), align=TextNode.ARight, scale = .07)



class PinkPiggy(DirectObject):
	def __init__(self):
     
	 self.keyMap = {"left":0, "right":0, "forward":0, "cam-left":0, "cam-right":0}
	 base.disableMouse()
	 base.enableParticles()
	 self.title = addTitle("Mini Pig Racing")
	 
	 forwardFN=ForceNode('world-forces')
	 forwardFNP=render.attachNewNode(forwardFN)
	 forwardForce=LinearVectorForce(0.1,0,0) #gravity acceleration
	 forwardFN.addForce(forwardForce)
   
     #Load the panda actor, and loop its animation
	 Node=NodePath(PandaNode("PhysicsNode"))
	 Node.reparentTo(render)
	 self.pinkpiggy=Actor.Actor("mrpiggyrun/pink_piggy", {"walk":"mrpiggyrun/pink_piggyWalk"})
	 self.pinkpiggy.setPlayRate(2.0, "walk")
	 self.pinkpiggy.loop("walk")
	 anpiggy=ActorNode("pinkpiggy-physics")
	 anpiggyp=Node.attachNewNode(anpiggy)
	 base.physicsMgr.attachPhysicalNode(anpiggy)
	 self.pinkpiggy.reparentTo(anpiggyp)
	 self.pinkpiggy.setScale(0.05,0.05,0.05)

	 self.pinkpiggy.setPos(-8.75,0.7,0.62)
	 self.pinkpiggy.setH(90)
	 anpiggy.getPhysical(0).addLinearForce(forwardForce)
	 anpiggy.getPhysicsObject().setMass(20)
	 self.pinkpiggycol=CollisionSphere(-8.75,0.7,0.62, 0.25)
	 self.colnodepinkpiggyPath=anpiggyp.attachNewNode(CollisionNode('pinknode'))
	 self.colnodepinkpiggyPath.node().addSolid(self.pinkpiggycol)
	 self.colnodepinkpiggyPath.show()
	 
	 self.haybale1=loader.loadModel("mrpiggyrun/haybale")
	 anhaybale1=ActorNode("haybale1-physics")
	 anhaybale1p=Node.attachNewNode(anhaybale1)
	 base.physicsMgr.attachPhysicalNode(anhaybale1)
	 self.haybale1.reparentTo(anhaybale1p)
	 self.haybale1.setScale(0.5,0.5,0.5)
	 self.haybale1.setPos(-3,-1.3,0.35)
	 anhaybale1.getPhysicsObject().setMass(20)
	 self.haybale1col=CollisionPolygon(Point3(0,0,-5), Point3(0,0,5), Point3(0,5,5), Point3(0,5,-5))
	 self.colnodehaybale1Path=anhaybale1p.attachNewNode(CollisionNode('haybale1node'))
	 self.colnodehaybale1Path.node().addSolid(self.haybale1col)
	 self.colnodehaybale1Path.show()
	 
	 self.camtrack=loader.loadModel("mrpiggyrun/haybale")
	 ancam=ActorNode("camtrack-physics")
	 ancamp=Node.attachNewNode(ancam)
	 base.physicsMgr.attachPhysicalNode(ancam)
	 self.camtrack.reparentTo(ancamp)
	 self.camtrack.setPos(-10.75,0.7,1.25)
	 self.camtrack.setScale(0.1,0.1,0.1)
	 ancam.getPhysical(0).addLinearForce(forwardForce)	 
	 
	 taskMgr.add(self.cam,"camTask")
	 
	 handler=CollisionHandlerEvent()
	 handler.addInPattern('%fn-into%in')
	 handler.addAgainPattern('%fn-again-%in')
	 handler.addOutPattern('%fn-out-%in')
	 
	 pusher.addCollider(self.colnodepinkpiggyPath, self.pinkpiggy, base.drive.node())
	 base.cTrav.addCollider(self.colnodepinkpiggyPath, pusher)
	 base.cTrav.showCollisions(render)
      
     #Load the first environment model
	 self.environ = loader.loadModel("mrpiggyrun/sky")
	 self.environ.reparentTo(render)
	 self.environ.setScale(3,1,1)
	 self.environ.setPos(0,0,0)
	 
	def cam(self, task):
		base.camera.setPos(self.camtrack, 0, 0, 0)
		base.camera.setH(self.pinkpiggy.getH()-180)
		base.camera.lookAt(self.pinkpiggy)
		return Task.cont

p = PinkPiggy()


run()

D’oh!!! I specified the wrong node!

self.pinkpiggy is indeed my Actor - re-coded to

pusher.addCollider(self.colnodepinkpiggyPath, anpiggyp, base.drive.node()) 

Piggy now hits the polygon and keeps on pushing into it - hoozah!

how about a link to download the “piggy” egg file. It kinda hard to evaluate what is going on without that.