World Model from P&C code snippet [solved]

Hello,

just tried the point & click code after pasted the whole code .

I did not found out the world to define, even with the author’s advices:
added the collide and the start point at the end gave me always errors.

As google and searches in the forum did not gave me results, what are the files needed to let the p&c code running please ?

David

What errors are you getting?

I took a simple working world and added what is told to, that makes :

<CoordinateSystem> { Z-up }

<Group> {
<Group> Plane01 {
<Collide> Plane01 { Polyset keep descend }
<VertexPool> Plane01.verts {
<Vertex> 0 {
-11.9472 -32.4651 0
<UV> { 0 0.2 }
<Normal> { -0.268248 -0.0474971 0.962178 }
}
<Group> start_point {
  <Transform> {
    <Matrix4> {
      1.000000 0.000000 0.000000 0.000000
      0.000000 1.000000 0.000000 0.000000
      0.000000 0.000000 1.000000 0.000000
      0.000000 0.000000 0.100000 1.000000
    }
  }
}
<Group> terrain {
  <VertexPool> terrain {
    <Vertex> 0 {
      35.000000 35.000000 0.000000
    }
    <Vertex> 1 {
      -35.000000 35.000000 0.000000
    }
    <Vertex> 2 {
      -35.000000 -35.000000 0.000000
    }
    <Vertex> 3 {
      35.000000 -35.000000 0.000000
    }
  }
  <Polygon> {
    <Normal> { 0.000000 0.000000 1.000000 }
    <VertexRef> { 0 1 2 3 <Ref> { terrain } }
  }
}

Therefore what happend is the following :

actually, you missed 2 end curly brackets.
this works :

<Group> Plane01 {
   <Collide> Plane01 { Polyset keep descend }
   <VertexPool> Plane01.verts {
      <Vertex> 0 {
      -11.9472 -32.4651 0
      <UV> { 0 0.2 }
      <Normal> { -0.268248 -0.0474971 0.962178 }
      }
   }
}

ok it’s better now, it become

<CoordinateSystem> { Z-up }
<Group> Plane01 {
   <Collide> Plane01 { Polyset keep descend }
   <VertexPool> Plane01.verts {
      <Vertex> 0 {
      -11.9472 -32.4651 0
      <UV> { 0 0.2 }
      <Normal> { -0.268248 -0.0474971 0.962178 }
      }
   }
}
<Group> start_point {
  <DCS> { net }
  <Transform> {
    <Matrix4> {
      1 0 0 0
      0 1 0 0
      0 0 1 0
      0.0 0.0 1.7 1
    }
    <Translate> { 0 0 0 }
  }
} 

1/ nevertheless the scene is with ralph alone and nothing else, I’ve checked the egg world and it is correct, the point code is exactly as exposed.

2/ In addition, at first click the scene is closed, the output is

I’ve tried the self.position (clicked point) with 3 floats with no success. :frowning:

I know that I can’t understand all at first time and I should go on with the documentation ; my thoughts is about to begin with working code like this one to get a step over the first doc. tutorials I already understood

It’s when self.position is None. You should check that first in moveToPosition :

    def moveToPosition(self):
        # Get the clicked position
        self.getPosition(base.mouseWatcherNode.getMouse())
        if self.position==None:
           return

ah ok ! it does not crash anymore thank you; but did I took a wrong code ? as in the code snippets there were not any return test.

Ralph is still alone in an empty world, but I will found out why. Just wondering
why the mouse click has no effect at all, Ralph stay standing.

sorry, I didn’t take a deeper look.
here :

self.ground = self.environ.find("**/Plane01")

Tiptoe’s terrain named “Plane01”, so you only need to add the red line (as she said) to your .egg :
Plane01 { Polyset keep descend }
With your current edit, the collision only done against Plane01, which is only 1 vertex (which couldn’t be your terrain).
This is how you should do it :

<Group> terrain {
  <Collide> Plane01 { Polyset keep descend }
  <VertexPool> terrain {
    <Vertex> 0 {
      35.000000 35.000000 0.000000
    }
    <Vertex> 1 {
      -35.000000 35.000000 0.000000
    }
    <Vertex> 2 {
      -35.000000 -35.000000 0.000000
    }
    <Vertex> 3 {
      35.000000 -35.000000 0.000000
    }
  }
  <Polygon> {
    <Normal> { 0.000000 0.000000 1.000000 }
    <VertexRef> { 0 1 2 3 <Ref> { terrain } }
  }
}

hmm not with that,

if I assemble what you told and what tip top explain the integrality of the egg is :

Therefore this happen:

I tried in many ways it can’t execute that.

weird. try change “Plane01” to “terrain”, both in your .egg and the script.

that’s it ! Ralp is moving to the clicked point.

Thank you, I now have many things to understand from what you did.