meshdrawer issues?[solved]

Iam using the meshdrawer to draw some fake-particles, working like a charm so far, but here comes the problem:

I need to reparent the meshdrawer-root to another nodepath, if i do so and rotate that node, the created billboards are no longer facing the camera. How can i fix this?

edit: this also happens when the meshdrawer root is parented to render and then the root is rotated…

....
generator.getRoot().setHpr(90,0,0)

edit2: Or is it possible to completly disable the the billboard-effect from the meshdrawer and rotate the particle by myself? The problem, the particles have only one rotation axis enabled as i see in the api, so how to rotate them in more than one axis? The rotaion should be easy to calculate because the camera is never moving in my game but the world is…

edit3: Problem solved: i had to provide the world node (the one i reparented the meshdrawer node to), to the draw task off the meshdrawer instead off “render”, now the billboard pointing to the camera always. Great! But my Problem from the nextPost still exists…

still having the above problems and searching for a solution, but i have found another big(er) problem:

I tryed the meshdrawer-class on another machine, on this machine im always getting the error:

TypeError: an integer is required

the error occures in the “drawloop” when i try to draw any meshdrawer object (like particle, billboard etc…) Other pandacode runs fine on this machine… any ideas?
(the one machine runs windows XP==runs fine, the other windows 7, but this shouldnt be the problem right?)

I spend much time to make my particles look cool and now it seems i cant use them in my game…so sad… please help me :confused:

In the “drawloop”? You mean in the igLoop task? What is the stack trace that is reported when you get that exception?

David

no, u got me wrong, with drawloop i meant the meshsdrawer specific lines between begin() and end():

self.generator.begin(base.cam,render)

for pos,frame,size,color,rotation in self.particles:
    #next line causes the error:
    self.generator.particle(pos,frame,size,color,rotation)

self.generator.end()

But as i said it runs fine on the other machine…heres the test-code:

from direct.showbase.DirectObject import DirectObject
import direct.directbase.DirectStart
from pandac.PandaModules import *
from random import *
from math import *


class FxDrawer(DirectObject):
    def __init__(self):
        print "init fxdrawer"
        
        
        self.generator = MeshDrawer()
        self.generator.setBudget(500) #max particles/triangles
        
        generatorNode = self.generator.getRoot()
        
        generatorNode.reparentTo(render)
        #generatorNode.reparentTo(self.world)
        generatorNode.setDepthWrite(False)
        generatorNode.setTransparency(True)
        generatorNode.setTwoSided(True)
        #generatorNode.setTexture(loader.loadTexture("../gfx/fxplate.png"))
        generatorNode.setBin("fixed",0)
        generatorNode.setLightOff(True)
        
        
        
        self.particleContainer=[]
        for i in range(5):             self.particleContainer.append([self.randVec(),Vec4(0,0,0,0),1,Vec4(1,1,1,1),0])
    
    def randVec(self):
        return Vec3(random()-.5,random()-.5,random()-.5)     
            
    def drawtask(self,taks):
        """ this is called every frame to regen the mesh """
        
        self.generator.begin(base.cam,render)
                
        
        for pos,frame,size,color,rotation in self.particleContainer:
            
            self.generator.particle(pos,frame,size,color,rotation)
        
        self.generator.end()
        return taks.cont
     
    def startDrawer(self):
        taskMgr.add(self.drawtask, "draw task")
    
    def stopDrawer(self):
        taskMgr.remove("draw task")
        
f=FxDrawer()
f.startDrawer()   
run() 

dont understand why this crashes my other machine…what can i do to find out why?

But there are also some good news: i solved my very first Problem, the one with the billboard rotation!

Sounds like you’re running an older version of Panda. In Panda3D 1.7.0, the prototype for MeshDrawer::particle() is:

  void particle(LVector3f pos, LVector4f frame, float size, LVector4f color, float rotation);

But in versions 1.6.2 and earlier, the prototype was:

  void particle(LVector3f pos, int frame, float size, LVector4f color, float rotation);

See the difference? In earlier versions, an integer was required for the second parameter.

David

Thanks for your help David, ur great!

ok, if i pass an integer as “frame”, the error is gone, but its realy 1.7 that is installed on the machine…
installed version is Panda3D-2010.01.11-15,the latest buildbot-version i had laying around ;D, cause there seems to be a problem with the windows buildbot (thers no download). Should i install another version on that machine? which one?

I think the latest Windows Buildbot release predates 1.7.0. The MeshDrawer changes in 1.7.0 were pretty much last-minute.

I recommend installing the official 1.7.0 release.

allright with a fresh install it finaly works!!! Yaaay! I was sure there was the 1.7 version installed because it was installed into the folder panda3d-1.7.0, well now it works and everything is fine! thankyou guys!