Few random questions... collision and some other things

Hi, I just got done with most of the upgrade for my game and have almost hit 100kb of lines for my game (around 2k lines ish). So to make sure things good smoothly for the nexts upgrades I want to make sure the current setup is ready and at its more opts for it.

So my questions are…

  1. I want to make the one big file into a few smaller ones. (Including, maps, player, weapons, other players, networking… so on) I’ve done a little with importing other files into the main file but not a alot and was wounding if there was any easy to understand examples out there I could follow? I did a google searches but I didnt find much or I could just be typing the wrong thing in.

  2. After a little pstat today I find that once I click to shoot and send my collision ray out there, it seem to stay out there causeing a little havit on the collision system. I want to go about this 2 ways… 1st I want to use CollisionSegment(ax, ay, az, bx, by, bz) but i’m not sure what all thos mean (ax-az, bx-bz). I tried this and it seems to make everything in the screen light up…

Another is how would you go about hiding it after you use it so its not sucking up the collision/fps?
I’m using that 3d code in the manual… I did all ready notice it didnt have a clean system or for what I used it for anyways…

            self.mpos=base.mouseWatcherNode.getMouse()
            self.pickerRay.setFromLens(base.camNode, self.mpos.getX(), self.mpos.getY())
            base.cTrav.traverse(render)
            if base.handler.getNumEntries() > 0:
              base.handler.sortEntries()
              self.pickedObj=base.handler.getEntry(0).getIntoNodePath()
              if not self.pickedObj.isEmpty():
                if self.pickedObj.getParent().getParent().getName() in self.userlist:
                  #print self.pickedObj.getParent().getParent().getName()
                  self.client.send(self.send)
  1. Also I notice pstat taking some fps away too, wasnt sure if that was normal.

  2. I’m also using base.camLens.setFar(2000) to limit what the user can see, but I wasnt really sure if it really work or not? Does it “hide” everything from the user after that distents or is everything still be drawn out?

They’ar just problems I had questions on really. They should be to hard to answer. I just wasn’t sure how it work or not.

1: sry dont have an easy example of this on my hands. but most python tutorials should cover how to import stuff from other files. pretty much every python application does this so you might be able to strip an existing one down.

2: ax, ay, az are the x,y,z coordinates of the starting point of your collision segment. bx,by,bz are the coordinates of the endpoint. you most likely want it to be something like (0,0,0, 0,100,0) or so.

3:that’s perfectly normal. as long as it’s just a little bit everything is fine.

4: setFar() does indeed set the far-clipping plane. nothingbehind this distance will be drawn , and if the objects boundaries are behind this line it wont get send to the gpu at all ginving you performance gains.
however 2000 can be quite a big value already, depending on your scene you might want to have it was lower.

Should I make the scene smaller or just sick with the defaults. I tried playing with them this morning and it seems resizing does help with a few things but it also a pain to redo, and I kept getting a line error for my models at one point (guess they were to small or something).

Or does sizes not really have a effects on things?

Not sure what you mean by making the scene smaller? What kind of error are you getting? Are you mixing very large scale objects with small ones?

Numeric precision might be causing issues if you are casting a very large line segment into a lot of very small, tightly packed polygons. Generally you want to keep the scale the same in your scene.

The manual says that the collision system in Panda doesn’t deal well with differences in scale of collision solids very well (I assume they mean mixing cNodes of different scales in the same traverser pass), so I would try to keep that in mind.

Not sure either now… the error seem to went away and eveything got a nice boost. Yea I keep everything in scale so no worrys there.

Thanks for the answer.

Question on clouds tho, for some reason the boreder is still there when I use setTransparency(TransparencyAttrib.MAlpha). I use the same setup for some crosshairs for my guns but the bored isnt there, why could this be?

Try using WMClamp as texture wrap modes.

Thanks, for some reason it started working after I posted it didnt work. Thanks for the tip on the clamp tho:P