Defeating friction?

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Defeating friction?

Post 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.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
SilentAngel
Captain
Posts: 239
Joined: Wed Mar 12, 2008 8:27 pm

Post by SilentAngel »

If no solution is found I'll code a replacement dynamics engine that handles this myself
:shock: whatte?! :shock:
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post 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.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post 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? :)
Image
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post 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.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
Tazz
Second Lieutenant
Posts: 155
Joined: Fri Feb 16, 2007 1:29 pm
Contact:

Post 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
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post 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.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
Post Reply