I was messing around with repeated prop forces when I discovered a way to easily simulate changing gravity on an object. Objects with reversed gravity will "fall" upward seamlessly, bouncing and rolling on the ceiling like they normally would on the floor. You can also still grab objects and throw them around, and I had a lot of fun lodging books on the undersides of tables.
Formula for calculating Prop Force
M = Mass of Object
G = Gravity Multiplier (2 = double, 1 = normal, 0 = no gravity, -1 = reversed)
F = (1-G) x 9.81M
(Also, forgive me for being a nerd, but since the formula pretty much came out to be Newton's second law, that leads me to believe the game technically uses kg for it's mass units, and Newtons for it's PropForce units. Cool little tidbit.)
(04-02-2012, 09:07 PM)Damascus Wrote: I was messing around with repeated prop forces when I discovered a way to easily simulate reversing gravity on an object. Once the script is activated, objects will "fall" upward seamlessly, bouncing and rolling on the ceiling like they normally would on the floor. You can also still grab objects and throw them around, and I had a lot of fun lodging books on the undersides of tables.
If you're extremely delicate about force, I think you can possibly modify it to reduce gravity and even make objects hover. Have fun playing with this!
You can indeed simulate pretty much perfect zero-gravity, with a loop running very fast indeed (0.015 or thereabouts), and the perfect amount of +Y force. For a wine bottle, that is 19.7, and a small throwable box is 118. It is, however, much easier to make a new model and untick 'Has Gravity'. Depends if you want to activate / deactivate it in script
I spent a fair amount of time in a very big room with lots of zero-g boxes after getting that right
(This post was last modified: 04-02-2012, 10:12 PM by Adrianis.)
Awesome! I played around with it some more and made some things hover in the air, too bad I can't just run up against things to push them around, I have to actually grab them.
Using your wine bottle example, and playing around with rocks some more, I updated the first post with a formula. One can use it to easily get a Prop Force number to give any object any force of gravity, positive or negative.
It doesn't work on things with multiple bodies with mass (like corpses), as the same force will be applied to every body. I ended up getting a corpse whose back was trying to fall and limbs were trying to rise. Kind of funny looking, but hey.
Awesome dude nice work, I was just gonna fiddle the sh*t out of every object I included to work out the right amount, but having a formula seems like a much better idea!
I'd love to see some sort of video of this, I MIGHT have gravity shifting/zero gravity sequences in my custom story and I thought it'd be nice to see how it looks before making a decision.
(04-05-2012, 10:28 AM)Homicide13 Wrote: Where can I find the mass of an entity? I feel like I've sen such an option somewhere but I can't find it now...
Its listed a property in the Model Editor for the Body of the model, first on the list.
Quote: I'd love to see some sort of video of this, I MIGHT have gravity shifting/zero gravity sequences in my custom story and I thought it'd be nice to see how it looks before making a decision.
Its super easy to set up dude, unfortunately I dont have any video capture software so I can't upload anything. Just stick a few small boxes in your existing map, use a timer in OnStart to set off another timer running every 0.015s looping AddPropForce("name of box", 0, 118, 0, ...)
As long as the timer is right, the effect is flawless, the way objects bounce around the room is perfect for zero-g, only issue is you cant push into things and have them move, meaning you can jump ontop of floating objects. Not so good.
After experimenting around with this a bit I have found one problem: air friction. Although an object might ignore gravity, it still slows down due to air friction. Does anybody know where the config files are for air friction controls (assuming there are any?)
(04-05-2012, 09:35 PM)Homicide13 Wrote: After experimenting around with this a bit I have found one problem: air friction. Although an object might ignore gravity, it still slows down due to air friction. Does anybody know where the config files are for air friction controls (assuming there are any?)
Never really considered that as the object would slow down in an environment with atmosphere. I doubt there is, but I'll let you know if I find a way of doing it. Likely there would be some performance issues having an entity never stop moving, but on a small scale shouldn't be too bad.
(04-05-2012, 10:56 AM)kman Wrote: I'd love to see some sort of video of this, I MIGHT have gravity shifting/zero gravity sequences in my custom story and I thought it'd be nice to see how it looks before making a decision.
I might make a video tonight, cause I have the software. I'll probably fill a room with some zero-g boxes and make four rocks: normal weight, half weight, zero weight, reverse weight. Then fling them around like a madman.