Boundries

Hi,

I’m using an environment (the normal ‘forest’ environment that comes with all panda3D or to put another way the one that is used in the hello world program from the manual).

I currently have a character that walks around this environment, but he manages to be able to walk straight through the trees and the rocks that are set out in the environment! He also managed to walk straight through the edge of the environment and into the unknown!

What is the best way to stop this from happening?? I’m assuming its some sort of collision nodes needed (which I have used elsewhere in my code, but I have actual models to attach them to which is why I can’t work out how to do with this problem)

And I guess an appropriate follow on would be if I change the environment, how would it be possible to make sure that in the new environment is set up right so the character cannot walk through things!

I hope this makes sense! If not let me know and I’ll get some screenshots posted so you can see what I mean.

Many thanks in advance

If anyone’s interested, once I have finished tweaking this code I’ll upload my creation for other people to have a look at. (well I’m pleased with it even if it is basic!). I also have documentation as well to explain everything better. This is aimed more at tiptoe as I know he is interested in seeing any examples in panda, plus he has helped me in the past.

At the moment the main character has to go around collecting 5 randomly placed lollipops, but he shouldn’t have the ability to walk through rocks and trees!

Tony

Yeah you have to setup CollsionHandling for the forest and your model
Look at this. It tells you how to setup collisions in a egg-file. So you can easily setup collisions for the models in the world

environ.egg

line 102:

<Group> TreeTrunk {
  <Collide> TreeTrunkCollision { polyset keep }
  <VertexPool> TreeTrunk.verts {

line 611:

<Group> Branch2 {
  <Collide> Branch2Collsion { polyset keep }
  <VertexPool> Branch2.verts {

line 645:

<Group> Ground {
  <Collide> CollisionGround { polyset keep }
  <VertexPool> Ground.verts {

aso.

Then you have to set the bitmasks for environment and model.
For each movement check if there are anycollisions.
If yes set the model back to its old pos

Hope this helps Martin

Also, take a look at the “Roaming Ralph” sample program that comes with the most recent version of panda.

Tony, I can hardly wait to check this out. Thanks for thinking of me. I’m currently working on collision stuff too (it’s very hard), so I’d really love to see how you go about doing this.

Oh, by the way, I’m a ‘she’ not a ‘he’ :wink:.

Cheers