Announcement

Collapse
No announcement yet.

Need help with gravity related coding

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Need help with gravity related coding

    I've though about posting this in the level editing forum, but my problem is most likely coding related.

    my problem:

    I've been thinking for a while now about making a small planet as level. and I mean an actual ball on which the players would run around. obviously this would be much smaller than a real planet, but a ball nonetheless.

    Now my problem is gravity. I'd need gravity like a planet has gravity, with the gravitational forces pointed towards the center of the planet, not (as ut2004 normall has) pointed downwards.

    My question is this:

    Is it possible to code an alternative gravity I could use, or is this engine related code which I cant change? And if possible, where would I start?

    #2
    i'm pretty sure you'd have to turn off the default gravity for the world, and write your own.

    it's a pretty fun idea though. i think you'd end up writing some kind of tick function for each pawn or whatever that drags it toward some actor (i.e. the center of your ball). just like gravity! let me know how it goes...

    Comment


      #3
      You could have hundreds of square-ish physics volumes on the surface of your spherical map. Each physic volume's Gravity vector could be modified to point toward the center of the sphere. You could do this at load time I would think?

      It's a very interesting idea for a mod.

      Comment


        #4
        This has been something people have been attempting to do since Unreal1 and it is incredibly difficult, the best results I've seen for attempting this are in the map DM2001 for Unreal1/UT1 where zone-portals where put in the map at an angle to simulate a doughnut shaped space station. (as in the film..2001 )

        EDIT:
        You need to completely rewrite the physics from scratch to be able to accomplish this in code, not worth it IMO and I doubt it can be done properly without access to the C++ source code.

        Comment


          #5
          Or... You could have everyone walk and have PHYS_Spider on all the time.

          Dicky B (I know, but you COULD)

          Comment


            #6
            true, but this wouldnt work for weapons (like the bio rifle). its an interesting begin though

            Comment


              #7
              Theoretically, it wouldn't be too hard. Gravity is actually a relatively simple thing.

              Decide what you want your gravity to be. The default is -950 per unreal second (which differs from a real life second a little due to the TimeDilation variable).

              First give the pawns PHYS_Spidering. Then write a tick function that goes through all actors to be affected by Gravity (that would need some optimization) and make a vector pointing from the actor's location to the center of the sphere, normalize it, and then multiply it by Gravity * DeltaTime.

              The new patch included a PHYS_Spidering fix too, so it probably works better now. The only issue I think would be speed. Normally, although gravity is specified in unrealscript, I believe it is applied natively since iterating through all gravity affected actors (those with PHYS_Falling, etc.) is probably slow.

              Comment


                #8
                Originally posted by -GSF-JohnDoe
                true, but this wouldnt work for weapons (like the bio rifle). its an interesting begin though
                Yeah, I know.

                Dicky B (besides, weird gravity type things make me nauseous)

                Comment


                  #9
                  I've messed with PHYS_Spider and SpiderWalking state code before myself, it's not nearly that easy........good luck

                  Comment


                    #10
                    I'm sure someone did something like this for a mod before. Can't remember which mod it was though.

                    Comment


                      #11
                      For UT there used to be a MATRIX mod that you walked on walls with.

                      Comment


                        #12
                        Sort of related....

                        In all my gravity messing about time ive never found how to make the players feet point towards the new 'ground', or rotate your view. Im sure ive heard of a switch which at least gives this functionality, effectively letting you walk on your head if the gravitys upwards, any ideas?

                        Comment


                          #13
                          http://www.macgamefiles.com/detail.php?item=13200#loop

                          Will let you walk and run on walls

                          Its called matrixMoves For UT

                          Comment

                          Working...
                          X