Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PoC] Custom Gravity
Abion47 Offline
Senior Member

Posts: 369
Threads: 22
Joined: Oct 2015
Reputation: 46
[PoC] Custom Gravity

I've heard more than one idea for a SOMA CS that takes place in space. Not only do these CS's have the opportunity to do some fun things with gravity in general, there's also the obvious choice of not having any gravity at all. With that in mind, I put in some effort to figure out how to actually achieve that.

[Image: 799748F89C17A10B8D8E91A4C8CB8E15009C1408]

As it turns out, it's pretty simple to override the default gravity of the world by using the map's PhysicsWorld's SetGravity function. Not only that but any entity that has a character body attached to it can also have a specific gravity applied to only it as well (and this includes the player themselves). An interesting effect of changing the default gravity, though, is that it draws attention to the fact that entities are physically static until they are interacted with, so changing the gravity will only actually have an effect on entities that the player has grabbed (or some other force has acted on).

Discovering this, I was able to get around this by using Entity_AddForce(entityName, cVector3f_Zero, false, false) when the map started to essentially poke an entity with a zero-force that triggers the entity's physics to kick in. This, of course, had the nasty side effect of that entity clattering about right off the bat, so in an actual mod, I'd suggest implementing this fix in a somewhat more intelligent manner. Tongue

Check it out on SteamWorkshop.
01-27-2016, 10:43 AM

Users browsing this thread: 1 Guest(s)