Gravity

I’m new to the forum, and super Excited for S&Box, I just had one question, would it be possible to change around the direction of gravity? like you put the center of gravity in the middle of a sphere and you can walk around the sphere? I don’t think that would work very well since it’s not built like Kerbal Space Program or Super Mario Galaxy. but would that type of thing be possible? I know there was a Localized Physics addon in Garry’s Mod, but that was specific to a certain prop and only was up and down. Given how dynamic S&Box will be, would something like this be possible?

I always found localized physics interesting, I hope someone touches on this via an add on later on. So much potential from add ons in all forms.

1 Like

They had it already when the game was on UE4, I don’t think they showed anything like this in Source 2 yet.

3 Likes

I remember reading a tweet from a Source2 developer that hr forgot to make the liquid shared get affected by gravity because it can change direction, so I guess it’s already implemented.
If someone can find the tweet that would be great.

1 Like

Ah yeah, that, in half-life alyx the final level has gravity being changed a lot, so there’s that.

1 Like

There is the trigger_physics mesh entity already in Source 2 that can change the direction of gravity (among other things) for physics objects within the trigger. As for clients, this isn’t the case right now (Valve had no need to because VR I suppose) so that would have to be implemented by either facepunch or a community developer.

2 Likes

Well in games like UE4 gravity is changed by with positive values for negative or lower gravity and lower values for higher gravtity. That was likely what was done in HL:VR not like localized gravity in a similar vein of interplanetary physics like this.

1 Like

S2 only does directional physics for actual physic objects I believe. However it would be extremely helpful to have directional gravity affect the player as well.

Like how Super Mario Galaxy has trigger boxes that change the gravity based on a defined shape.

1 Like

I swear there was a dev video of gravity being linked to an object and easily rotating the object to change it in a dev vid, but I’m not sure if that was on source 2?
either way I hope it is since it would be a cool feature to have

gravity can only be changed along one axis though, for s&box it would be nice to be able to change gravity along all axes

14 Likes

i knew i remember seeing a vid like that, but then i was like, wait nah fuck im probably talking shit so i had deleted what i had to say, that shits cool though, it can allow so much potential cool shit to be done. or just out right fucking around with it, but that still hella fun imo.
thanks layla :sunglasses:

Is there any effects on players as well?

The player controller is something you can edit yourself, it shouldn’t be too difficult to make it obey gravity the same way.

3 Likes

I guess I was mostly wondering if it was tried yet, but I looked at the code on the Github and pretty much had any questions answered

This has nothing to do with the gravity controller but I love the map Layla used in the video :joy:

Hey there. I’m curious about this to because I jury-rigged a grenade to create a “Zero G field” in HLA using Lua to basically “Push” props, NPCs, and items up in the air at just the right amount to give the illusion they float up. I’m wondering if I will have to rebuild the code from scratch since S&Box will use C#.

You’ll have to rewrite it, but I imagine the tools you used to implement it in HLA via Lua will be pretty similar to what’s offered to you in Sandbox. If you can apply gravitational changes on a per-entity basis, you would just do that to all entities in the given sphere and maybe give them a slight push upwards to get them moving.

1 Like

Yes, you need to rewite it. I sugggest to read this doc about migrating from Lua to C#:

Thanks for showing that! I’m very interested in the exact properties of this tool.

Now I know a lot (or all) of these things are things we ourselves could do in C# if the gravity modifier doesn’t already have these capabilities, but I’m wondering:

  • If the gravity modifier has filter properties so it can be applied to only specific props or types of entities, and so that multiple gravity modifiers can be active at the same time for separate groups of entities?
  • If it can be used on players in any way?
  • And if it can be used on players, would it automatically reorient their body and camera orientations to reflect the new gravity?