How to use different "gravity" for some entities i

Discuss anything not covered by any of the other categories.
Post Reply
Seven
Posts: 301
Joined: Sat Oct 06, 2007 8:49 pm
Location: Germany

How to use different "gravity" for some entities i

Post by Seven »

Hello,

I am stuck with a problem and ask for your help.

Using Ivana Gibson´s TUT for kickable gibs, I am not happy with the gib behaviour.

Gibs are using MOVETYPE_BOUNCE (as defined in players.qc).
I feel like the bouncing is too much like "pingpong" for the heavy gib pieces.
Thats why I searched for a way to increase their weight by increasing the gravity for them.

There is a code in Mission Pack 2 (example: antigrav_belt):
self.gravity = 0.25;
Trying this line in Quake 1.06 source failed due to "unknown value" error.

My questions:
Is the "gravity" a new value, introduced in Mission pack 2 ?
How could I implement it into Quake ?
I searched through all Mission Pack 2 .qc files, but didnt find the definition for "gravity".


Setting the complete map gravity (via engine cvar): sv_gravity 1500
looks perfect for the gib behaviour, but of course everything else is affected by the new gravity (what I dont want)

Thank you very much for your help.
Seven


PS: I played with the gibs velocity values a long time and found the best settings so that they are not kicked so far and high.
Now all that is left is to reduce the "bouncing" behaviour for them.
I know that MOVETYPE_TOSS could be used for them, but this has no bouncing at all (what I dont want as well).
Supa
Posts: 164
Joined: Tue Oct 26, 2004 8:10 am

Post by Supa »

You don't need to specifically implement .gravity into Quake, it's a less documented feature of v1.08 (or v1.07, I can't remember) and onwards. What you do need to do, however, is define it in the QC gamecode like any other float field with .float gravity.
aut viam inveniam aut faciam
leileilol
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Post by leileilol »

gravity was new in 1.07 (and all ports support it). if you try gravity in 1.06 or earlier, it'll just be regular gravity

All you have to do is stick this on the end of defs.qc

Code: Select all

.float gravity;
NOW YOU CAN USE GRAVITY!
i should not be here
Seven
Posts: 301
Joined: Sat Oct 06, 2007 8:49 pm
Location: Germany

Post by Seven »

Supa & leileilol,

things are so easy, once kind and experienced people like you explain it :)

With your help I could make it work in Quake 1.06.
Now the gibs have the correct "weight".

I heard about Quake 1.07 / 1.08 many times but never found a source from it. Wonder if it exist.

Thank you again for your swift replies !
Seven
leileilol
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Post by leileilol »

1.07 ships with Scourge of Armagon (mission pack 1). 1.08 ships with Dissolution of Eternity (mission pack 2). 1.09 supercedes both as WinQuake and GLQuake (there is no dos 1.09), and is the version of the GPL source release.
i should not be here
Swift
Posts: 60
Joined: Tue Jan 26, 2010 11:02 am

Post by Swift »

Wouldn't this make more sense if it were called 'mass' instead?
leileilol
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Post by leileilol »

ARE YOU QUESTIONING CARMACK'S NAMING PRACTICES?
i should not be here
Swift
Posts: 60
Joined: Tue Jan 26, 2010 11:02 am

Post by Swift »

I haven't looked at the QC source in a long while - but this thread makes it sound like gravity is some (global) scalar field related to mass.

As opposed to acceleration caused by gravitation.

Makes me wonder about Carmacks formal education. So yeh, I is. : ]
Lardarse
Posts: 266
Joined: Sat Nov 05, 2005 1:58 pm
Location: Bristol, UK

Post by Lardarse »

Swift wrote:Wouldn't this make more sense if it were called 'mass' instead?
No.

The mass of an object does not change how fast it accelerates. There's a fairly fanmous experiment involving a tennis ball and a cricket ball that demonstrates this.
Roaming status: Testing and documentation
Swift
Posts: 60
Joined: Tue Jan 26, 2010 11:02 am

Post by Swift »

I'm well aware of Newtons laws - it was the OPs verbiage that threw me.

"Thats why I searched for a way to increase their weight by increasing the gravity for them. "

Anyway, if the gibs are flying off too hard, wouldn't you want to reduce the inital velocity, instead of increasing gravitational decay?
r00k
Posts: 1111
Joined: Sat Nov 13, 2004 10:39 pm

Post by r00k »

Weird, never new about the .gravity field, though I think it would look ODD if one object fell faster than another if pushed off a ledge. Like if I assigned player.gravity = 1000 to someone holding a flag. versus a normal player at 800 gravity. In real life both would fall at same rate, i havent tested this field though i would assume the 'heavier' player would drop faster.

If you want to slow the velocity of an item based on it's "MASS" just do something like the watermove code does

Code: Select all

self.velocity = self.velocity - 0.8*self.waterlevel*frametime*self.velocity;
change self.waterlevel to the value of your mass ??
Sure it's not college level physics but it will work close enough...
Swift
Posts: 60
Joined: Tue Jan 26, 2010 11:02 am

Post by Swift »

Pretty much.

K = (1/2)m v^2
Keeping initial energy constant (from the kick)- increasing m decreases v.
Seven
Posts: 301
Joined: Sat Oct 06, 2007 8:49 pm
Location: Germany

Re: How to use different "gravity" for some entities i

Post by Seven »

Hello,

sorry for bumping this old thread.
But I think this information is maybe interesting for others as well.

I found a maybe better way to deal with "gravity" behaviour for entities, that shall bounce.
(that was my initial issue in this thread)

For DP users, you can make use of this dpextensions feature:
DP_SV_BOUNCEFACTOR

I know, this is old news for many of you, but the reason why nobody suggested it that time
when this thread was born made me think that not everybody is aware of it.

That is all I wanted to say :)
Thank you again for helping me back in april this year.

Kind regards,
Seven
Post Reply