Page 1 of 1

Gravity Entity

Posted: Thu Mar 16, 2006 12:48 am
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.

Posted: Thu Mar 16, 2006 12:50 am
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....

Posted: Mon Apr 10, 2006 3:10 pm
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?

Posted: Wed Apr 12, 2006 3:36 am
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.

Posted: Wed Apr 12, 2006 9:06 am
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

Posted: Wed Apr 12, 2006 7:55 pm
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

Re: Gravity Entity

Posted: Wed Jan 07, 2009 6:36 am
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.

Re: Gravity Entity

Posted: Fri Jan 09, 2009 7:34 am
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?

Re: Gravity Entity

Posted: Fri Jan 09, 2009 2:59 pm
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.

Re: Gravity Entity

Posted: Sun Jan 11, 2009 1:18 am
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!

Re: Gravity Entity

Posted: Wed Jan 14, 2009 5:38 am
by ix-ir
I'd be very interested to see what you come up with misanthropia.

Re: Gravity Entity

Posted: Wed Jan 14, 2009 9:35 am
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).

Re: Gravity Entity

Posted: Thu Jan 15, 2009 8:16 pm
by Silicone_Milk
Isn't that the definition of programming though? Being lazy enough to automate actions? :p

Re: Gravity Entity

Posted: Sat Feb 14, 2009 4:13 am
by ix-ir
Did you come up with any ideas for this misantropia?

Re: Gravity Entity

Posted: Sat Feb 14, 2009 2:56 pm
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;
    }

Re: Gravity Entity

Posted: Fri Feb 20, 2009 2:11 am
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.

Re: Gravity Entity

Posted: Fri Feb 27, 2009 9:03 pm
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.

Re: Gravity Entity

Posted: Thu Mar 05, 2009 4:12 pm
by MKJ
maybe check out how serious sam does it. that has gravity changing in real time

Re: Gravity Entity

Posted: Thu Mar 05, 2009 9:01 pm
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 :)