Page 1 of 1

elasticity and friction fix

PostPosted: Fri Jun 11, 2010 3:16 pm
by D'Lanor
I'm sure everyone has noticed that in writers' ages the avatar bounces off colliders in a strange way, which does not happen in Cyan's ages.

This is caused by a bug in PyPRP which sets the default restitution (elasticity) to -1. FYI Cyan's default for restitution is 0.
As a compensation for this bouncing PyPRP also uses a very high default value for friction of 10. Cyan's friction default is 0.5.

I have conformed both to Cyan's values and I must say that everything feels much more natural in my ages now. :) This fix can be downloaded from my SVN contrib folder here: prp_ObjClasses.py.

Note that this change will affect the physics in your age so if you are going to use it you will have to go through all areas and check if everything still behaves as it should, especially if you have puzzles that depend on physics. Yes, I know it can be a pain to redo your tweaking but believe me: You will like this. ;)


P.S. If you decide to test this, please post feedback here.

Re: elasticity and friction fix

PostPosted: Sat Jun 12, 2010 12:34 am
by tachzusamm
Hey, this is GREAT!

Indeed, I was already wondering what was going wrong when my avatar bounces back from colliders; seemed there were springs or some sort of invisible elastic material. Playing around with different collider types did not help. Now it works much better, and as expected.
As a side effect, some of my stairs work better now. I had some issues with the first step of stairs - it was not possible to walk over the first step without running (yes, I did not use an invisible collider ramp, but triangle mesh bounds - because it looks a bit more natural. The height of one step is 0.6 ft. - about 18cm.). Yesterday I thought about adding a ramp at least for the first step - but today it's no longer necessary. Very nice.

I love it. 8-)

Thanks.

Re: elasticity and friction fix

PostPosted: Sat Jun 12, 2010 8:14 am
by diafero
I always wondered where this bouncing came from... good catch, D'Lanor!

Re: elasticity and friction fix

PostPosted: Sat Jun 12, 2010 10:32 am
by D'Lanor
I have done some further testing. My age Prad, which has a physics dependent "puzzle", still works great. It does feel different though, so I guess it will be easier for some people and harder for others, but such is life.

One issue I had is that without the bouncing two of my colliders now sometimes cause the avatar to go into fall mode (flailing arms), without actually falling. And if I don't maneuver out of it I eventually link out. It is probably no coincidence that both colliders are complexly shaped objects which I used Triangle Mesh bounds for, and maybe should have given separate colliders with Convex Hull bounds the way Cyan does. That is the only downside I have discovered so far.

Re: elasticity and friction fix

PostPosted: Sat Jun 12, 2010 3:14 pm
by Aloys
What is really mind boggling is that no one noticed it before, this bug has been here for, what, nearly 5 years?

Re: elasticity and friction fix

PostPosted: Sat Jun 12, 2010 3:23 pm
by Paradox
I know there was some discussion about friction when we rewrote part of the plugin just before the fork. Something about friction not being disabled properly, so we used a really high value as a default. In retrospect it sounds like we were missing a flag of some sort.

I haven't tried your fix specifically, but PyPRP2-dev used 0 for both values and I was able to walk around my test Age with no problems. I fully support a merge of this to trunk (along with your waveset GeoState fixes... why haven't those been merged yet?)

Re: elasticity and friction fix

PostPosted: Sat Jun 12, 2010 7:02 pm
by Aloys
Paradox wrote:I know there was some discussion about friction when we rewrote part of the plugin just before the fork. Something about friction not being disabled properly, so we used a really high value as a default. In retrospect it sounds like we were missing a flag of some sort.

Indeed, that does ring a bell. The first Ages were totally made of ice, and I do remember a discussion of that style were you went with an eye-balled value that just seemed to work.

Re: elasticity and friction fix

PostPosted: Sat Jun 19, 2010 9:28 am
by D'Lanor
Paradox wrote:I haven't tried your fix specifically, but PyPRP2-dev used 0 for both values and I was able to walk around my test Age with no problems. I fully support a merge of this to trunk (along with your waveset GeoState fixes... why haven't those been merged yet?)

Yes, you'll be able to walk with friction 0 but when you do a run/jump you will start sliding. In fact only floors need friction but I don't think there is any way for PyPRP to tell if the collider is a floor or a wall.

Feel free to merge them then. :) btw, the other files in my contrib folder can be merged safely as well. They are well tested and non-breaking additions to the quickscripts and wizards.