Hi guys
The first cry for help!
I’ve looked through the forum and couldn’t find an answer to this so am posting this problem here.
I’m trying to set up collision nodes within my environment to stop my character walking through trees and things.
I’ve edited my environment.egg file as below (only the code that matters I’ve included!):
<Group> TreeTrunk {
<Collide> TreeTrunkCollision { polyset keep }
<VertexPool> TreeTrunk.verts {
<Vertex> 1 {
21.4707 -78.7459 0.0441827
<Normal> { 0.461362 0.0371902 -0.0615218 }
<UV> { 0.726553 0.0298222 }
}
I’m using this code below in the main file (again, only the code that matters I’ve included!):
# Load an environment
self.environ = loader.loadModel("Environments/Environment.egg")
self.environ.reparentTo(render)
self.environ.setScale(0.25,0.25,0.25)
self.environ.setPos(-8,42,0)
def EnvironmentCollide(self):
#This sets up the collisions as edited in the environment.egg file
# this tells panda its a geom collision node
TreeTrunk = self.environ.find("**/TreeTrunkCollision")
# Set the collision bit in the IntoCollideMask
TreeTrunk.node().setIntoCollideMask(BitMask32.bit(0))
# end EnvironmentCollide
And I’m getting this error:
Warning: DirectNotify: category 'Interval' already exists
DirectStart: Starting the game.
Known pipe types:
wglGraphicsPipe
(3 aux display modules not yet loaded.)
:display:windisplay(warning): SetForegroundWindow() failed!
Assertion failed: !is_empty() at line 270 of c:\temp\mkpr\panda3d-1.2.1\panda\sr
c\pgraph\nodePath.I
Traceback (most recent call last):
File "main.py", line 190, in ?
w= World()
File "main.py", line 35, in __init__
self.EnvironmentCollide()
File "main.py", line 185, in EnvironmentCollide
TreeTrunk.node().setIntoCollideMask(BitMask32.bit(0))
AssertionError: !is_empty() at line 270 of c:\temp\mkpr\panda3d-1.2.1\panda\src\
pgraph\nodePath.I
It looks like the names of everything is ok and that I’m calling the right things in the right places, so I don’t quite get it to why it is claiming that it is empty.
I’m assuming that the way the above code works is it looks in the environment.egg file for matches of the collisionnode and sets it up as a collision (and apologies if that makes no sense or is explained poorly)
I have no doubt as usual I’ve named one thing wrong, but any help is appreciated!
Tony