Any pointers on how to use the Physics System?

I have another problem…

I would love to get through this without complaining.

From: Panda3D Manual: Notes and caveats

This is what the Friction Coefficient Options section says…

setDynamicFrictionCoef
void PhysicsCollisionHandler::set_dynamic_friction_coef(float coef);

Undocumented function.

setStaticFrictionCoef
void PhysicsCollisionHandler::set_static_friction_coef(float coef);

Undocumented function.

Please, Please… Tell me, HOW am I supposed to figure this out on my own from the API and the manual when the examples appear to be incorrect or unfinished, the documentation is sketchy and refers to APIs that are undocumented?

EVERY PATH is closed, yet I am expected to do this on my own?

I’m a relatively experienced programmer that taught myself PERL, PHP and now Python but this is getting ridiculous.

Panda3D appears to be a very interesting and capable engine, but without documentation or because of people that chastise you for not reading non-existing documentation, it is hard on the border of ludicris. If Disney did not intend on this being a fully functional engine, why give it to us in the first place?

I really, really want to use it, but I have have spent two weeks of solid coding, reading, and absorbing, but I feel I am little further along than when I started…

I desperatly want to know about the physics engine, gravity, collisions and networking. There are mysterious methods riddled throughout the API that refer to functions I am really going to need to pull off this Multi Player Social Network I have visualized. I have limited resources so I ask, what profit is there in taking the mis-steps to code hundreds of routines that are already in the API, but undocumented when IF I had proper documentation, I could easily use those methods and focus my programming on the areas that ARE NOT covered in the API. It would be a much better use of my time.

BTW - just knowing the API is not good enough. There is nothing in there about how to put the literal 1,000’s of methods together.

Real programming manuals present material in groups and show how you use the various tools in combinations to achieve tasks. There are even groups of methods that would be far more effiecient than others in achieving various tasks, but the API doesnt tell any of this. Somebody that already KNOWS, has to impart that knowledge, or eventually, after the momentum is over, the project dies.

I really dont want that to happen with Panda. I would also like to contribute, but I dont have the technical knowlege to turn the API into meaningful information.

What started this was the various parts of the documentation that refer to each other without actually answering the question.

I have a surface and I have a player avatar that I drop onto the surface. I originally used the Ralph routines to detect the surface.getZ(), to properly land the avatar on the ground.

Now, I think I have gravity working, but the collision routines that worked so well before, seem to not work at all now. The avatar falls right through the floor.

The new docs on Physics (thanks Fixer!) refer to using PhysicsCollisionHandler instead of CollisionHandlerPusher… I guess this would be great … IF you knew what a CollisionHandlerPusher WAS or why you should or shouldnt be using it in the first place!!!

Like I said, I borrowed from Ralph, so my routines are…


        self.ralphGroundRay = CollisionRay()
        self.ralphGroundRay.setOrigin(0,0,1000)
        self.ralphGroundRay.setDirection(Vec3(0,0,-1))
        self.ralphGroundCol = CollisionNode('ralphRay')
        self.ralphGroundCol.addSolid(self.ralphGroundRay)
        self.ralphGroundCol.setFromCollideMask(BitMask32.bit(1))
        self.ralphGroundCol.setIntoCollideMask(BitMask32.allOff())
        self.ralphGroundColNp = self.ralph.attachNewNode(self.ralphGroundCol)
        self.ralphGroundHandler = CollisionHandlerQueue()
        self.cTrav.addCollider(self.ralphGroundColNp, self.ralphGroundHandler)

and further along…


   # Adjust ralph's Z coordinate.  If ralph's ray hit terrain,
        # update his Z. If it hit anything else, or didn't hit anything, put
        # him back where he was last frame.

        entries = []
        for i in range(self.ralphGroundHandler.getNumEntries()):
            entry = self.ralphGroundHandler.getEntry(i)
            entries.append(entry)

        entries.sort(lambda x,y: cmp(y.getSurfacePoint(render).getZ(),x.getSurfacePoint(render).getZ()))

        envZ = entries[0].getSurfacePoint(render).getZ()
        ralphZ = self.ralph.getZ()
        print ralphZ, envZ
        
        if (len(entries)>0 and envZ-ralphZ<0.5 ):
            pass
            #self.ralph.setZ(envZ)
        else:
            self.ralph.setPos(startpos)

This code worked fine until I seem to have actually stumbled on working gravity… at least the avatar starts falling and falls through the floor … and keeps falling.

Also, within the API, I see

a lot as the description within the API. As much as I like and need to be reminded… im not sure that the appropriate section?

I can’t really help you with undocumented panda functions, but I can tell you about “other paths”.

Panda3D is primarily a real-time graphics rendering engine. It is capable of many more things, but you might find other (free) libraries more suited to them.

Panda3D is (to my knowledge) capable of only rudimentary physics operations intended, as drwr said, for particle effects. If you need a more capable (or better documented) physics engine, tryPyODE (the Python bindings for The Open Dynamics Engine.) ODE is a Real-time rigid body dynamics/collision detection physics engine. ODE is much more capable than Panda3D’s built-in physics engine. Here is an example using Panda3D for graphics and PyODE for physics. You can search the forums for more.

Don’t get me wrong, Panda3D needs better documentation, but if you’re that frustrated, why re-invent the wheel? There are many free libraries written for Python, therefore they can be used with Panda3D.

@Cyan - I appreciate your help…

However, if you look at the API, you will see a number of glorious functions that will save tons of time for anyone creating a multi-player game with Panda. Unfortunately, they are mostly undocumented.

A perfect example…

The very point is that I am NOT trying to reinvent the wheel. There are features of this class that are very desirable to anyone integrating multiple avatars into the same renderNode.

But the API is there, but no docs to put it together. Yes, I know people like David are very helpful, but it kinda defeats the purpose when you dont even know what question to ask.

The actorNode variable in that section of the manual is class ActorNode, not ForceNode. This area may be a little confusing; if so, I apologize. I followed the code example format used in other sections of the manual; since Panda3D doesn’t have statically-typed variables, it can be a little difficult to keep track of what the type of each variable used in the examples is. In general, if you don’t see an instance initialized in the code segment, its name should match the name of its class (with a lowercase leading letter instead of uppercase).

Take care,
Mark

In the open source community, it is rare that anything ever gets accomplished on one’s own :wink:

I share your frustration with the state of the Panda documentation. At Sim Ops Studios, we find ourselves pushing the engine pretty hard most days; I stumble across exceptions, unexpected behaviors, quirks, and the (very) occasional engine-level bug frequently. When I have an issue that I can’t solve, my method is first to review the manual, second to read the class documentation (which is often “Undocumented”), third to post to the forum, and fourth to crack open the source code itself. Every open source project is different; Panda3D doesn’t have a dedicated documentation team (that I am aware of), so often the forum is the place to find answers to detail-related questions.

When the forum can’t help, however, there’s always the option of looking into the source code—by definition, it’s the final arbiter on how the engine behaves. It’s not as easy as having the answer available for handy reference in the manual, but it’s guaranteed to be as comprehensive as can be. Regardless of the engine you use, if you have the source code, I recommend reading through as much of it as you can; there will often be more functionality in there than makes it to the documentation.

Panda3D is a big engine, and I think you’ve set yourself a very big goal in terms of a fully-functional multiplayer social game. I wouldn’t be too concerned if you still feel lost after two weeks of working in it; I spent an entire semester working in the engine during the Building Virtual Worlds class at CMU, and I still have days of “Ah-ha! I wish I’d known that was there sooner!” The best advice I can offer is to keep working on it, and when you hit a wall, keep asking the forum. People here are (more often than not) helpful, and if you were unfairly chastised for missing a piece of the manual, that shouldn’t have happened.

As to your question concerning Roaming Ralph and the physics system: I’ll have to get back to my computer with all the examples installed to double-check this, but if I recall correctly, Ralph’s collision is interesting because he is essentially “glued” to the floor; a CollisionHandlerQueue is used to determine where the vector pointing down off of Ralph intersects the ground, and Ralph gets placed on the ground at that location. If you have a gravity force applied, my hunch is that you’ll run into problems because the CollisionHandlerQueue doesn’t change Ralph’s velocity; even though he’s glued to the floor, his downward velocity is getting higher and higher, and eventually he’ll go falling through the floor because the collision engine isn’t great at handling very high-speed objects crashing through polygons. The PhysicsCollisionHandler updates an ActorNode’s velocity when it is used, setting the velocity appropriately (i.e. using Newtonian physics) if an object collides with a surface. But as the manual section on collision handlers explains, PhysicsCollisionHandler is a subclass of CollisionHandlerPusher, hence the note in the “caveats” section of the manual.

Take care,
Mark

Hi ta2025,

I think you may need to step away from what you are doing for a while and work on something else!

Try not to bite the hand that is feeding us. Disney VR doesn’t need to give us anything and the Carnegie Mellon ETC doesn’t need to let us use their forums.

In short, we just need to be thankful for what we have. I’m often surprised why people think that these free projects owe them anything.

Would I like better documentation or more examples? Sure thing, if it doesn’t happen, I can’t really complain, this is all free.

David Rose (drwr) from Disney VR comes in here almost 7 days-a-week to try and help people out with Panda3d. Many of us, myself included, don’t have a clue for the most part about game development or 3d graphics and he still helps us out!

All I’m saying is please show a little restraint when complaining about this project.

It gets frustrating at times, I know, but if you walk away and work on something else for a while it helps.

Steve

@SM3 - I am grateful to the people that try to help… However, we all have goals and deadlines. There are times when you cannot go another step further without a fix because something really stupid is happening and there is no documentation and after 16 straight hours of banging one’s head against the monitor and the floor and the wall and cat…

I struggled get physics working, just to have the rest of it break… That is where I was FORCED to walk away and vent.

There are tons of open-source projects out there and many of them get documented. Linux, Blender, POV, PHP, Python, Ruby, MySQL, etc… They are all open source and they have manuals and APIs miles long… It is not an unfair request. As I have said before… I would LOVE to to write the docs myself…If I had a clue. Someday I might.

@Fixer - I appreciate your response.

I have been following the same path with one exception. I am in no way a C++ programmer. You might as well take the Panda source code and hit me upside the head with it for the good it would do. That path is closed. right now, I am totally dependant on the docs, the API and the Forum. Unfortunately, when they get outside the realm of the rather simple to the almost coomplicated, there is a large amount of contradiction in the community. I can look at teh different methods of collisions all night long and without some kind of example or introduction, I dont have a clue. However, with the tiniest morsel of explanation, I can code for hours…

Yes, we have bitten off a rather large project. the project was there long before we found Panda.

We fleshed a lot of it out on paper long before we picked a program or an engine. We know what we want and we know how we want it to behave. We chose Python as the most likely language out there. something we could program at both the core level … AND… for the web interfaces we are developing – so the code will mesh together more fluently. Then we chose Panda3D as the most impressive engine to accomplish the task.

What I have done so far made me a believer of Panda and rapid prototyping. The quote of “two weeks” only applies to this little part Im working on right now, but I feel I have accomplished a hell of a lot in 4 weeks. We have a long way to go, but we have a goal and a plan.

The only thing getting in the way is the documentation. Unfortunately, its not enough to just ask questions in the forums… the best anyone can generally do for you is tell you whether your routine is goinf to work or not… if you only know of 2 out of 5 methods of collision-handlers, the other 3 might as well be on Mars.

Again, im just venting… Thanks for all your help so far. We’ll get through this.

ta2025, I understand.

There is a difference between this project and Blender3d or some of the other open source projects out there. You can almost say that this project has two official developers, David Rose from Disney VR and Josh Yelon from Carnegie Mellon ETC. I’m sure David is being helped by co-workers at Disney and from time-to-time Josh has a student or two to help with tutorials or what have you, but for the most part that’s it.

The Disney folks aren’t being paid to write documentation for us. Each piece of code they write, is documented in the C++ source and that is what produces the manual for the most part. The students at the ETC are really there for one thing, to learn what they need for their classes and that’s it.

So you see, this project really only has 2 developers.

Steve

@SM3 - and that is my fault in some way? I am sympathetic, but only person on the planet that can write any documentation is someone that already knows the system!

We have a really bad catch-22 here.

No, it’s not your fault. Not real sure why you think I said it’s your fault.

I guess you want what you want and nobody is going to change your mind.

Steve

I think with 2 major devs the work is spread to an optimal level. One actively developing, the other actively helping. More (detailed) documentation with examples is alwas a nice-to-have, but as you see, we don’t have that :stuck_out_tongue:

The question is: Who do you want to stop from its work to get the manual work (a huge pile of work - so the one doing it would be unavailable for weeks/months) done? Josh - for the price of stopped/extremely delayed development? drwr - for the price of lacking unpayable (we will never be able to find a correct value in respect to drwr’s posts quality and quantity) support?

At least for me both answers will be “no”.

I said it already and I love to say it again. Panda3D is a community project somehow. Docs are the thing WE can do. And if we have questions while doing so, I believe our questions will be answered by any of the devs in no time.

Regards, Bigfoot29

PS: Just on a side note: There are a BUNCH of devs involved into Panda3D. I can’t believe that Disney just has one dev involved when releasing already 2 games using Panda3D. And there are also quite a bunch of people writing bug fixes or porting Panda3D to Mac… They all deserve our thankfullness. Not our hate because of a not-beginner-friendly documentation. Because if somebody IS advanced, then he can get the info needed from looking into the existing pieces of work done by the devs.

Edit: That excludes me as well, defining me as not-advanced. ^^’

@Bigfoot

Where am I being hateful?

To be fair though, advanced users who don’t know C++ need documentation too. They can’t code out of thin air. Thats the biggest stumbling block. I can read code and examples, but I can’t really make heads or tails out of C++ headers.

When I say advanced user, I mean someone who knows C++ well and is very familiar with 3d concepts and algorithms. Knowing Python well but not C++ isn’t going to help if the documentation is spotty, I agree.

I’m not sure if you’ve noticed, but in the “Panda Greeting Card” when you first install Panda3d it says something like… “A gift from Carnegie Mellon…”. Carnegie Mellon took what Disney VR released, added some necessary bits pre-compiled for us, made a manual and website and allow us to access it. I want to stress the “gift” part.

I don’t know about you, but if someone gives me a present. let’s say a shiny new digital camera, I don’t say “Oh gee, thanks, but you didn’t provide a flash with it.” The basic camera is there, what else I do with it is my problem.

I own licenses to many low-cost 3d engines. I own Torque TGE, T2D, TSE, C4, Cipher, BeyondVirtual and 3Impact. All of those I’ve paid money for. All of them provide what they do as-is for the most part and documentation is no better or worse then what we get here for free with Panda3d.

With Cipher it’s written in C. I know basic C, however, what I don’t really know well is OpenGL and 3d. I have the source code though and I’m slowly understanding how it does things on the graphics end. Slowly! There is far more documentation for this free Panda3d project than for Cipher which I paid $US dollars for.

I think you only have 3 choices here really: 1) wait for documentation 2) make do with what you have 3) learn C++ and 3d and figure it out yourself or modify it accordingly. The 4th option may be to try something different.

Making games or anything in 3d is not easy.

Steve

Just to clearify things. “hatefull” might have been the wrong word. English isn’t my mother tongue. I meant demanding… forcefully requesting instead of asking.

We know that there are many gaps and white spaces in the documentation. But a community project is living from its - well - community. Several people do their best to help the project… But only very few are into documentation writing. Its sad, but its a fact.

So basically the answer seems to be "no better Manual untill we either find a good manual writer or we pay ca$$ for a programmer to do so. But tbh: Both ways don’t look like they would come true in the next time XD

Regards, Bigfoot29