Game Development Community

A level with no gravity ?

by Jan Guilfoyle · in Torque Game Engine · 02/13/2007 (5:10 am) · 6 replies

Im trying to make a level in space, where there would be no gravity, and also no terrain. The main character would be changed to a spaceship. I think the character changing is ok, but how would I go about creating the level ?

#1
02/13/2007 (5:36 am)
Well, definitely don't include a Terrain() call in the .mis file. That will take care of your no terrain. For testing purposes, though, you might want to include a really large object as a point of reference, so you don't get lost (mission area helps too).

See this resource for implementing zero gravity, and other gravity controls: Dynamic and Individualized Gravity

Whoops. . .except your profile shows you don't have the SDK, which means you won't have access to the source code =(. If this is the case, I'll look into an alternate approach, or you could have someone you know with the SDK compile the .exe for you.
#2
02/13/2007 (6:52 am)
@Jan

First off, let me strongly encourage you to get the TGE source. It has been an excellent investment for me.

With that said, I'll move on to your question. It *is* possible to get zero gravity-like effects without fiddling with the engine source code. It's hackish and wierd and I can't explain why it works, but it does.

By accident, I created a mission/level with the waterblock that was too high, effectively submerging most of my interiors, static objects, rigid body shapes, etc. To fix it, I went into the world editor (F11) and lowered the waterblock height settings numerically. The wierd thing is that afterward, I noticed that I could float/push my rigid body objects all over the place with any weapon/projectile that exerts impulse forces.

Here's a video of it in action (in xViD format) . . .

www.aaronellis.net/phunwithphysics.avi

I don't know if it's a beneficial bug or what. I don't know if it works with 1.5 as well as 1.42. I do know that I haven't changed any of the physics code in the engine to get this effect. And I do know that the effect is 100% repeatable on my setup.
#3
02/13/2007 (7:14 am)
Aaron: Thats a very interesting idea, and it sounds effective in counter-acting gravity. The only thing would be that it is the player itself I will need to be able to counter gravity, in order to fly the ship in around space. Your objects seem to float, but it seems your player is still grounded in the video?

Michael: Thanks for looking at this. I havent got the SDK, I am still new to Torque, and I actually have no experience with any programming (Im a modeller). Is there no other way to access the default gravity setting on a level ?

thanks for all help so far
#4
02/13/2007 (7:15 am)
As far as I can tell, gravity is object specific...meaning you can change the gravity of an object upon creation. Without a resource,I don't think there is a global gravity variable accessible from script.
#5
02/13/2007 (9:11 am)
@Jan

If all you need is zero-G flying vehicles, then that is easy to do -- in the engine code. It's just a matter of changing one value from -20 to 0 (if I recall correctly). Exposing the value to script would take a little more work (but not much).

If you had the engine and a decent compiler, I would say that one of us could walk you through the process in the private forums. Other than that, the only other possible option might be for you to hire a contractor to create a customized version for you. As I understand things, that is legal for commercial TGE licensees. It would be the same as building a prototype for a client.
#6
02/13/2007 (12:28 pm)
If you can't modify the engine source, you could try to achieve something similar to zero-G by creating a really, really large PhysicalZone that generates zero gravity.

If you do get access to the source, the dynamic and individualized gravity resource linked above is your best bet, since it offers the most flexibility.