dlewin
October 5, 2007, 9:40pm
1
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
rdb
October 6, 2007, 6:17am
2
What errors are you getting?
dlewin
October 6, 2007, 9:47am
3
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 :
C:\programmation\Panda_divers>ppython mousewalker.py
DirectStart: Starting the game.
Warning: DirectNotify: category ‘Interval’ already exists
Known pipe types:
wglGraphicsPipe
(3 aux display modules not yet loaded.)
:util(warning): Adjusting global clock’s real time by 0.587488 seconds.
Error in /c/programmation/Panda_divers/models/testdav_simple.egg at line 12, column 7:
[color=red] start_point {
^
parse error
:egg2pg(error): Error reading /c/programmation/Panda_divers/models/testdav_simple.egg
:loader(error): Couldn’t load file models/testdav_simple.egg: all matching files on model path invalid (the mo
del path is currently: “/c/programmation/Panda_divers;/c/Python25/Panda3D-1.4.0/etc/…;/c/Python25/Panda3D-1.4
.0/etc/…/models”)
Traceback (most recent call last):
File “mousewalker.py”, line 266, in ?
c = Controls()
File “mousewalker.py”, line 19, in init
self.loadModels()
File “mousewalker.py”, line 44, in loadModels
self.environ.reparentTo(render) # Place it in the scene.
AttributeError: ‘NoneType’ object has no attribute ‘reparentTo’
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 }
}
}
}
dlewin
October 6, 2007, 10:07pm
5
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
File “mousewalker.py”, line 222, in moveToPosition
self.npLook.lookAt(self.position)
TypeError: Arguments must match one of:
lookAt(non-const NodePath this, const Point3 point)
lookAt(non-const NodePath this, const NodePath other)
lookAt(non-const NodePath this, const Point3 point, const Vec3 up)
lookAt(non-const NodePath this, const NodePath other, const Point3 point)
lookAt(non-const NodePath this, const NodePath other, const Point3 point, const Vec3 up)
lookAt(non-const NodePath this, float x, float y, float z)
lookAt(non-const NodePath this, const NodePath other, float x, float y, float z)
I’ve tried the self.position (clicked point) with 3 floats with no success.
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
dlewin
October 7, 2007, 8:58am
7
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 } }
}
}
dlewin
October 7, 2007, 7:31pm
9
hmm not with that,
if I assemble what you told and what tip top explain the integrality of the egg is :
Therefore this happen:
Traceback (most recent call last):
File “mousewalker.py”, line 268, in ?
c = Controls()
File “mousewalker.py”, line 20, in init
self.setupCollisions()
File “mousewalker.py”, line 97, in setupCollisions
self.ground.node().setIntoCollideMask(BitMask32.bit(0))
AssertionError: !is_empty() at line 273 of c:\temp\mkpr\panda\src\pgraph\nodePath.I
I tried in many ways it can’t execute that.
weird. try change “Plane01” to “terrain”, both in your .egg and the script.
dlewin
October 8, 2007, 8:00pm
11
that’s it ! Ralp is moving to the clicked point.
Thank you, I now have many things to understand from what you did.