Forum

How to use different "gravity" for some entities i

Discuss anything not covered by any of the other categories.

Moderator: InsideQC Admins

How to use different "gravity" for some entities i

Postby Seven » Mon Apr 25, 2011 12:35 pm

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).
Seven
 
Posts: 301
Joined: Sat Oct 06, 2007 8:49 pm
Location: Germany

Postby Supa » Mon Apr 25, 2011 12:56 pm

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
User avatar
Supa
 
Posts: 164
Joined: Tue Oct 26, 2004 8:10 am

Postby leileilol » Mon Apr 25, 2011 6:01 pm

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
leileilol
 
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Postby Seven » Mon Apr 25, 2011 7:23 pm

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
Seven
 
Posts: 301
Joined: Sat Oct 06, 2007 8:49 pm
Location: Germany

Postby leileilol » Mon Apr 25, 2011 10:37 pm

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
leileilol
 
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Postby Swift » Sat May 21, 2011 11:41 am

Wouldn't this make more sense if it were called 'mass' instead?
Swift
 
Posts: 60
Joined: Tue Jan 26, 2010 11:02 am

Postby leileilol » Sat May 21, 2011 9:09 pm

ARE YOU QUESTIONING CARMACK'S NAMING PRACTICES?
i should not be here
leileilol
 
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Postby Swift » Sun May 22, 2011 5:02 am

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. : ]
Swift
 
Posts: 60
Joined: Tue Jan 26, 2010 11:02 am

Postby Lardarse » Tue May 24, 2011 12:27 pm

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
User avatar
Lardarse
 
Posts: 266
Joined: Sat Nov 05, 2005 1:58 pm
Location: Bristol, UK

Postby Swift » Tue May 24, 2011 6:36 pm

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?
Swift
 
Posts: 60
Joined: Tue Jan 26, 2010 11:02 am

Postby r00k » Wed May 25, 2011 4:26 am

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...
r00k
 
Posts: 1110
Joined: Sat Nov 13, 2004 10:39 pm

Postby Swift » Wed May 25, 2011 6:30 am

Pretty much.

K = (1/2)m v^2
Keeping initial energy constant (from the kick)- increasing m decreases v.
Swift
 
Posts: 60
Joined: Tue Jan 26, 2010 11:02 am

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

Postby Seven » Wed Dec 21, 2011 10:21 am

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
Seven
 
Posts: 301
Joined: Sat Oct 06, 2007 8:49 pm
Location: Germany


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests