Page 1 of 1

Defeating friction?

Posted: Wed May 06, 2009 2:29 pm
by Rookie One.pl
I'm having a hard time trying to convince the MoHAA physics engine to cooperate. Script_objects tend to 'stick' to surfaces (i.e. it's hard to set them in motion again once they come to a rest, they often stay in place even if large impulses are applied, especially those which are coplanar to the surface). I guess it was a poor attempt at implementing friction, but it drives me nuts! Any ideas how to overcome this? It's been making me hold back a pretty cool physics-based mod. :)

If no solution is found I'll code a replacement dynamics engine that handles this myself, but I'd like to avoid that, as the game's built-in physics engine is more accurate in terms of collision detection and smoother in dynamics.

Posted: Wed May 06, 2009 9:18 pm
by SilentAngel
If no solution is found I'll code a replacement dynamics engine that handles this myself
:shock: whatte?! :shock:

Posted: Wed May 06, 2009 10:31 pm
by Rookie One.pl
Yeah, the dynamics I need are not that complicated and can be coded in the script. :) Only it will involve a surface normal calculation for bounces, and the only method I can apply here is not exactly reliable. That's the main reason why I'd like to stick with what the game offers.

Posted: Sat May 09, 2009 7:08 am
by jv_map
Hmm.. ambitious :)

Unfortunately the built-in physics engine is almost useless, I don't think you can do anything to change the friction. Or, hmm, one thing you could try is to first apply a minor impulse away from the surface (so the object comes 'loose'), and only then apply the main impulse.

What are you going to make? :)

Posted: Sat May 09, 2009 8:54 pm
by Rookie One.pl
I know it's useless, but I just need it to handle small objects bouncing off walls in a believable manner. I'm making climbable ropes. :)

I tried adding a minor impulse, but the thing is that once an object comes to a rest, it's almost impossible to break contact with the ground solely by applying velocity, regardless of the magnitude of the impulse. :? I've also come upon some other anomalies, like the fact that a resting object doesn't even have a velocity vector of ( 0 0 0 ) but rather ( 0 0 1 ), and mind you, it's not moving. :?

I'm afraid I'll have to code my own little physics engine for this.

Looking at the cvar list right now I see there's something called "sv_friction" with a default value of 4. I'll check if this has anything to do with the object physics engine.

Posted: Sun May 10, 2009 3:21 pm
by Tazz
i know im not anywhere in the scripting the way yall r...by no means but is there a way u could class the object like a nade that would bounce off things?....just wondering but that might be hard coded in the game too not sure...but i would think if u could make the game think its a nade then it would probably have those properties as one...just a thought

Posted: Sun May 10, 2009 9:38 pm
by Rookie One.pl
Projectiles and script_objects (I'm using the latter) have exactly the same physical properties. ;) Plus using projectiles would probably mean the need to introduce new TIKIs which I want to avoid in order to keep the mod server-side.