Please help with models!

Good day, Thank you for your attention!
I must admint I am very very new to panda and pyhton, I started both 2 weeks ago and did not have much time to work on them. (sadly)

I am now experimenting with the “Roaming Ralph” game, all went well untill I decided to import my own terran collision model.

In the manual it said that to set collision you have to import a line in the egg file, I did as said and it still did not work…
I tried to PUNZIP Ralph’s world model, but it did not work properly, the text does not follow usual model body and has plenty of weird letters and zeroes, I guess it is because the file is very big.

So, can someone please tell me WHERE do I copy the line in the egg file (or post a part of the egg model body text where the line is in good position)

Im sorry for thge dumb question, but I really tried anything and it did not work.

Here is very simple “terrain” - a square textured polygon:

<CoordinateSystem> { Z-up }

<Texture> grass {
  grass.jpg
  <Scalar> format { rgb }
  <Scalar> wrapu { repeat }
  <Scalar> wrapv { repeat }
  <Scalar> minfilter { linear_mipmap_linear }
  <Scalar> magfilter { linear }
  <Transform> {
    <Matrix3> {
      1 0 0
      0 1 0
      0 0 1
    }
  }
}

<Group> terrain {
  <Collide> { Polyset keep descend }
  <VertexPool> terrain {
    <Vertex> 0 {
      5.0 5.0 0.0
      <UV> { -1.000000 1.000000 }
    }
    <Vertex> 1 {
      -5.0 5.0 0.0
      <UV> { -1.000000 -1.000000 }
    }
    <Vertex> 2 {
      -5.0 -5.0 0.0
      <UV> { 1.000000 -1.000000 }
    }
    <Vertex> 3 {
      5.0 -5.0 0.0
      <UV> { 1.000000 1.000000 }
    }
  }
  <Polygon> {
    <TRef> { grass }
    <Normal> { 0.000000 -0.000000 1.000000 }
    <VertexRef> { 0 1 2 3 <Ref> { terrain } }
  }
}

" terrain" is the terrain Ralph will collide with.
" { Polyset keep descend }" is what you need to add in order to make it “collidable”.

Which 3D modeller are you using? If you’re on Maya, take a look at the pipeline forum, there’s an interesting MELscript there for tagging models in Maya.

If not then manual tagging would be the way to go. Steps:

  1. In your 3d modeler, name your terrain/collision geometry. This will allow you to find it in the egg file later.
  2. Export to egg.
  3. Open the egg file in a text editor and search for " terrainName"
  4. Under the group, add your tags like so:
<Group> terrainName {
  <Collide> { polyset descend }
  <VertexPool> terrainName {
....

If your geometry is purely a collision mesh, the above collide tag will work. If its both a collision mesh and the actual visual geometry, use the collide tag from birukoff’s example. For a more indepth view of the collide tags, refer to this (copy paste the URL):
panda3d.cvs.sourceforge.net/*che … Syntax.txt

Thanks for your help - I was able to make my terrain visible! ,
but the object I am using as “Ralph” can not move though.
I enabled the script to show

I am using misfit3d to make the model (since its easier to tecture at the level I am at) (its a free program too) then:
save to ms3d
open with Milkshape, export as a directX8 file
use x2egg to get the egg model
change egg text to get collision
uze pzip to convert to .egg.pz

Anyways, here is a script from my model, to save space I used a basic prism.

{ Y-Up-Left }

{
“x2egg w2.x w2.egg”
}
tref1 {
hedge.jpg
}
w2 {
Ground { Polyset descend }
{ 1 }
Scene_Root {
{
{
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
}
}
Ground {
{
{
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
}
}
{
Ground {
0 {
3.33569 -0.3053 -3.32438
{ 0 0 }
{ 0 0 -1 }
}
1 {
-3.31307 0.079152 -3.32438
{ 0 1 }
{ 0 0 -1 }
}

      and so on

Thanks alot!

Next time use the code tags. Second, as far as I can see you’re trying to apply the collide nodes to the wrong group, I think my instructions didn’t take into account how meshes are exported from other programs. What you want to apply the collide node to is the group that has the VertexPool you want, anyway updated instructions below:

  1. In your 3d modeler, name your terrain/collision geometry. This will allow you to find it in the egg file later.
  2. Export to egg.
  3. Open the egg file in a text editor and search for " terrainName"
  4. Edit as below:

Edited

<Group> [optional terrainName] {
  <Collide> { polyset descend }
  <VertexPool> terrainName {
.... 

Thanks a lot for your reply!
The collision now works perfectly and my object “roams” well.
After all I think I will check out g-max and maya 3d studios since it seems to be the most popular ones (on the forums)

Again, thanks for your help!

check out blender blender.org/ is free and support panda3d egg format quite well - and lots of people here use it.