Gravity Entity

Locked
Silicone_Milk
Posts: 2237
Joined: Sat Mar 12, 2005 10:49 pm

Gravity Entity

Post by Silicone_Milk »

So, after seeing SO many questions about gravity in Q3 and how to walk on walls etc I decided that Im going to make a small mod removing the default gravity and creating gravity entities that can be placed in the map with settings much like the lights.
When you get close to one gravity entity you'll detach from the last entity and attach to the new one whose angle (set in the map editor) will determine if your standing sideways, upside down, or right side up.

I wont be able to start work on this for quite some time though due to the fact that my computer access is quite limited at the moment.
Silicone_Milk
Posts: 2237
Joined: Sat Mar 12, 2005 10:49 pm

Post by Silicone_Milk »

upon putting more thought into the situation of coming into contact with two entities and deciding which gets priority Im thinking perhaps a surface parm might do the trick to switch from ground to wall to ceiling
hmm....
4days
Posts: 5465
Joined: Tue Apr 16, 2002 7:00 am

Post by 4days »

would that be an issue? what about the 'location' thing mappers can set so players can say where they are on the map - could it work similarly to that?
Silicone_Milk
Posts: 2237
Joined: Sat Mar 12, 2005 10:49 pm

Post by Silicone_Milk »

it could... but I still have to determine which way is up for the model to be positioned correctly and then which gravity entity Im connected to to determine which surface Im stuck to.
Oeloe
Posts: 1529
Joined: Fri Mar 19, 2004 8:00 am

Post by Oeloe »

Are you going to add gravity vectors of surfaces that influence players/items simultaneously then? That might get quite complicated/cpu heavy. Just wondering how you would handle situations where you approach multiple surfaces with different gravity parms under an angle, like this:

Image

It would be funny if grenades would be influenced by gravity too btw. :) I played a mod that could change the nade speed, which i changed to
Silicone_Milk
Posts: 2237
Joined: Sat Mar 12, 2005 10:49 pm

Post by Silicone_Milk »

glad you asked. Excellent drawing btw. It's almost exactly what I'm going for but there's a slight difference.

Image

The entity is adjustable much like a light. The circumference will determine the area of pull by the entity much like it determines amount of light for the light entity.

The entities will be drawn to this gravity source.

When two gravity "nodes" have areas that overlap that's where the surface params should come in.
The surface params will determine which node the player (and all the child projectiles fired at the time) will be affected by and which nodes will be ignored.

The child projectiles will be independent of the parent when the parent switches to a new surface param so it will continue to follow the rules of the node the parent was on when it was fired.

however, now that I just thought of that the real reason Im going about this mod is to make magnetic boots for a larger project Im working on. If this is the case then the gernades should just all obey the regular gravity and drop to the ground.

Hmmm.... damn I have to think that one through hehe. Maybe Ill make two mods, one where the projectiles will pass into sepearate zones and adhere to the gravity node assigned to that zone so one minute it will go straight down then suddenly fly left lol. That would be pretty interesting.

Alright well I gotta run. Food to eat and work to do ;)

Cya,
Silicone_Milk
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Re: Gravity Entity

Post by ^misantropia^ »

Nothing like bumping a topic that's been dead for over two years. Did you ever get this to work? I was tinkering with something quite similar (but volumes instead of entities). Got the physics working fine but I ran into a rather major shortcoming: I can't for the life of me get models to render but top down. It's like that movie 'It', everyone is floating down here.
Silicone_Milk
Posts: 2237
Joined: Sat Mar 12, 2005 10:49 pm

Re: Gravity Entity

Post by Silicone_Milk »

That's beyond weird. I just dug this thread up and was having a nostalgic moment last week.

I never even put down a single line of code on this. Still quite an interesting idea in my opinion.

Why have you decided to go with volumes (zones? more manageable than a ton of entities?) rather than entities?
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Re: Gravity Entity

Post by ^misantropia^ »

It's easier for the mapper because he/she can clearly lay out the area of gravity. With entities, you're stuck with trial and error.
JPL
Posts: 13
Joined: Sun Nov 11, 2007 1:17 am

Re: Gravity Entity

Post by JPL »

Oh yeah, I remember this one.

Many years ago now a friend of mine was working on something like this. As I recall, one of the biggest problems he ran into was getting the players' axis-aligned bounding boxes to be the right shape and orientation (such as AABB have one) for any given gravity surface.

However the big difference now is that we have full source access, so it's definitely possible. Tremulous has some sort of wall-walking implementation for their little running aliens, but I'm not sure how full-fledged it is.

I considered doing something like this for my project, but figured I'd run into some beastly math at some point and get discouraged. Best of luck if you decide to try it!
ix-ir
Posts: 192
Joined: Wed May 16, 2007 9:43 pm

Re: Gravity Entity

Post by ix-ir »

I'd be very interested to see what you come up with misanthropia.
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Re: Gravity Entity

Post by ^misantropia^ »

I'm pondering this one, right now. I'll see if I can come up with something that works well enough (and doesn't force me to rewrite half the render code; I'm a lazy bum, you see).
Silicone_Milk
Posts: 2237
Joined: Sat Mar 12, 2005 10:49 pm

Re: Gravity Entity

Post by Silicone_Milk »

Isn't that the definition of programming though? Being lazy enough to automate actions? :p
ix-ir
Posts: 192
Joined: Wed May 16, 2007 9:43 pm

Re: Gravity Entity

Post by ix-ir »

Did you come up with any ideas for this misantropia?
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Re: Gravity Entity

Post by ^misantropia^ »

Sort of. Let's call it a meta idea. :)

It consists of two parts: 1) manipulating the axis[3] field in the refEntity_t of the model, and 2) rendering the three parts of the model - head, torso and legs - at right angles and distances. The first part I got working, the second part needs some straightening out (but I just might get to that later today). If you like, below is a somewhat eerie example of #1. Insert just before the call to trap_R_AddRefEntityToScene() in CG_AddTestModel() (cgame/cg_view.c) and in the console type: /testmodel models/players/doom/head

Code: Select all

    {
        static int pitch = 0, roll = 0;
        vec3_t angles;

        VectorMA( cg.refdef.vieworg, 20, cg.refdef.viewaxis[0], cg.testModelEntity.origin );
        angles[PITCH] = pitch;
        angles[YAW] = 180 + cg.refdefViewAngles[1];
        angles[ROLL] = roll;
        AnglesToAxis( angles, cg.testModelEntity.axis );

        pitch = (pitch + 1) % 360;
        roll = (roll + 1) % 360;
    }
Silicone_Milk
Posts: 2237
Joined: Sat Mar 12, 2005 10:49 pm

Re: Gravity Entity

Post by Silicone_Milk »

Might be interested in this: http://www.xreal-project.net/wordpress/

Wall walking has been implemented and seems to work pretty damn well.
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Re: Gravity Entity

Post by obsidian »

Anyone played Prey? Walk on walls, gravity changes, localized gravity, etc. Doom3 (id Tech 4) engine, btw... but I don't think it would be all that different from a programming point of view.
[size=85][url=http://gtkradiant.com]GtkRadiant[/url] | [url=http://q3map2.robotrenegade.com]Q3Map2[/url] | [url=http://q3map2.robotrenegade.com/docs/shader_manual/]Shader Manual[/url][/size]
User avatar
MKJ
Posts: 32581
Joined: Fri Nov 24, 2000 8:00 am

Re: Gravity Entity

Post by MKJ »

maybe check out how serious sam does it. that has gravity changing in real time
epicgoo
Posts: 44
Joined: Sun Mar 01, 2009 4:24 pm

Re: Gravity Entity

Post by epicgoo »

Silicone_Milk wrote:Might be interested in this: http://www.xreal-project.net/wordpress/

Wall walking has been implemented and seems to work pretty damn well.
it is just tremulous. nothing new. real shortcoming is the lack of oriented bounding boxes.
not very useful for tall player models :)
Locked