Collisions are not my friends (RoamingRalph questions)


Still struggling to make my collisions working… and I’m having many questions:

1 - For the line

ralphStartPos = self.environ.find("**/start_point").getPos()

Why is that start_point needed ? I guess it’s a point on the terrain somewhere but why this way and not assigning everything to (0,0,0)
Also, what is that start_point ? An empty ? A point that belong to the terrain ?

2- As I’m not understanding its utility, I removed it and replaced the terrain by my own terrain. Everything is well rendered but Ralph is keeping the same pos and playing the run anim.
And I can’t undersand why! Tried to position him at different places but no improuvement. Is it related to question (1) because of that start_point

3 - The terrain is considered as an Into object, right ?
As I understood the manual, we don’t need to do anything to Into objects as all of them are considered by Panda as Into objects. We just need to work on our From objects adding them to a Traverser.
Is this understanding correct ?
(Asking that because there is no collisions between my objects and starting asking myself if I missed something)

4 - For the line :

if (len(entries)>0) and (entries[0].getIntoNode().getName() == "terrain"):

Is “terrain” the ID of the plane created ?
I mean, if my terrain is called “terrain_grass” in Blender, Panda is notified at this line, correct ?
What about the other objects then ? Should we write the same thing for each object in our scene like walls, trees, houses… ?
Isn’t there an easier way to say: if YOU (stupid FROM object) coliide with any Into object then STOP!

Two weeks trying to make a character walk properly on a ground… How did you guys managed to understand and make things work with your collisions ???
Thanks in advance to untie the node in my head…

the first time i generated a terrain (procedurally) by myself, collisions weren’t working. After some time i realized that the normals of my terrain where inverted, i was creating the nodes in inverse order for saying it in some way, so the collision ray wasn’t working.
It looks that’s not the case, but just in case.

Because the player shouldn’t start on (0, 0, 0) in this case. But yeah, designing your terrain in such a way that the player starts on (0, 0, 0) is a working approach too.

An empty mesh created in the modeling program that indicates the starting position of the player. In Blender, this could be an Empty indeed.

I bet you didn’t add collide stuff to the terrain model. (explained how, below)

Almost. You either need to enable into bitmasks for the visible geometry (not recommended! this is a slow way for collision detection), or you need to have specific collision geometry for the terrain (or tell panda to generate it in the egg file), this is what Roaming Ralph does.

No, you should name it “terrain” in Blender.

Anyways, this will probably solve your problems: (assuming you use Blender)
(1) Create an Empty called “start_point” just a little bit above where the feet of the player should start.
(2) Select your terrain mesh and name it “terrain”.
(3) Terrain mesh still selected, go to the Logic panel and create a new property called “Collide”. Make it a String property and give it the value “Polyset keep descend”.

I can’t believe it! It’s working :smiley: Thank you VERY much pro-soft…

What’s the aim of adding that property ? I mean I thought that clicking on the “Collision Octree” button was supposed to be enough!!
I red again the Chicken exporter and I found that ther’s a topic talking about these properties but don’t really understand their utility yet.

1 - So, am I supposed to use this way for all m objects when exporting them or only for the “terrain” ?

2 - I was going to use a CollisionTube for my Avatars but apparently, that’s a bad idea. Alternative = two collisions spheres (one on top of the other) ??

And thanks again for the support :wink:

Here I am with a new question concerning the find stuff!
My code looks something like this:

        self.startPos = self.environ.find('**/Botom_right')
        self.middle = self.environ.find('**/Middle')

The problem is that ObjA and ObjB don’t appear where they should be and I guess it’s related to the scaling. I commented the scaling lines and no improuvment. I also tried something like:

self.startPos.setPos(self.startPos.getX()*0.3, self.startPos.getY()*0.3, self.startPos.getZ()*0.3)

which didn’t help…

Any idea how to bypass that ?

Okay! I just understood from where is the problem coming from.
It’s absolutly not related to scaling or to the find function but to parenting!

I figured that using a very simple code:


if self.keyMap["p_button"]==1:      #if the P button is pressed
   print self.objA.getPos()

When redering, my object A is well on (0,0,0) but when pressing “p” it goes to (0,0,1) but I don’t want it there!!
Commenting or leaving the line self.objA.setPos(0,0,0) is having the exact same result.

I don’t understand this behaviour, parenting object between them is useless if they must share the same position. I’m missing something and I don’t know where…

An object inherits its parent’s transform. When you then apply an additional setPos() to the object, this is relative to the parent’s origin, instead of relative to render. This is normally the most important reason for creating a parent/child relationship. If you don’t want this behavior, you can use wrtReparentTo() instead of reparentTo() (which automatically computes the correct counter-transform to apply to the object), but if you don’t want this behavior, are you sure you want to structure your scene graph like this?


I wanted to structure it like that… But I changed my whole scene graph because I’m not understanding this parenting system… … yet…

The only thing I wanted to do was to keep the transformation of the two objects while moving the parent but, additionaly to my previous problem, I faced a second one while moving my parent along the Y axis…
The parent was an empty and (this is only a guess) I think the empty keep its orientation properties even if I modify its heading…

Anyway, from what was suppose to be a structure that shall simplify my objects’s behaviours, I created a complicated scene… And rewrote evrything…!