Announcement

Collapse
No announcement yet.

gravity Q

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

    gravity Q

    im wondering about gravity is there anyway i can make it so u can walk or have gravity work on all sides of a sphere?

    #2
    Re: gravity Q

    Originally posted by POw-MIA
    im wondering about gravity is there anyway i can make it so u can walk or have gravity work on all sides of a sphere?
    Theoretically yes, but this would require a load of pyramid shaped physics volumes. The engine doesn't currently support point gravity.

    However, the player cannot walk on all sides of it. He will cling to the surface, but he will be facing upwards. In effect, he will be drawn toward the middle, but he cannot walk on the surface.

    Comment


      #3
      Wait to see if they fixed warpzones in the new editor.

      Otherwise think of something else.

      It will happen someday.:up:





      Comment


        #4
        Even if they do fix warpzones there's still a 64 zone limit. Making a cube world would take 30.

        Comment


          #5
          Your best bet would be to use spidering if you want to accomplish that.

          Comment


            #6
            whats spidering is that where you use a lot of volumes? I think thats a poor approach to this problem.

            :<

            I also am interested in getting gravity to point to a sphere.

            Comment


              #7
              No, you change the physics mode of the pawn to spidering and then it will walk on walls and surfaces.

              Comment


                #8
                I see. However, that wont help my spaceship orbit a planet.
                Thank you for the answer though.

                Matt Pratt
                http://marsmod.com
                Mars Mod Mission Manager

                Comment


                  #9
                  If you are designing a simulator, then yes you would need to do the actual physics calculations for orbiting a planet, which in themselves are not that hard.

                  However, the velocity vector to acheive a stable orbit is an exacting calculation. If you just want the player to enter an orbit, why not just "fake it" by getting the radius from the center of the planet, and then on your tick event for the ship, update the position based on a rotation around that point?

                  Comment


                    #10
                    I had the same idea a while ago.

                    Whats Spidering?

                    Comment


                      #11
                      Spidering is when in code you change the default karma physics model for the actor.

                      SetPhysics(PHYS_Spidering)


                      That will allow the pawn to walk on walls.

                      Comment


                        #12
                        Hi

                        I often hear that people try to do this. Here is how I have done it. Its a volume that a map maker can put in the map and then gravity points toward the middle of that volume when you are inside it. Outiside of it its buisness as usual. Also in UED you can set a few options.
                        Cheers;
                        Matt
                        http://marsmod.com


                        //************************************************** ************************
                        *
                        // This is the Mars Mod code base. It is property of the Mars Mod team and
                        // should not be copied without the permission of the Mars Mod team.
                        // You can contact the marsmod team at marsmod@hotmail.com or by visiting
                        // the forums at http://marsmod.com
                        //************************************************** ************************
                        *

                        class mars_Gravity_PhysicsVolume extends PhysicsVolume;

                        var() float KillTime; // How long to kill the player?
                        var() float StartFlashScale; // Fog values for client death sequence
                        var() Vector StartFlashFog;
                        var() float EndFlashScale;
                        var() Vector EndFlashFog;
                        var float DieFOV; // Field of view when dead (interpolates)
                        var float DieDrawScale; // Drawscale when dead
                        var float TimePassed;
                        var bool bTriggered; // Ensure that it doesn't update until it should
                        var bool bScreamed;
                        var() bool bCenterGravity; // New Gravity Toggle.
                        var float bGravityFactor; // New Gravity Variable.


                        // When an actor leaves this zone, set the variables back to where they
                        were.
                        event PawnLeavingVolume(Pawn Other)
                        {
                        if ( Other.IsPlayerPawn() ){
                        TriggerEvent(Event,self, Other);
                        Disable('Timer');
                        }
                        Other.Controller.ConsoleCommand("SAY speed set back to 100");
                        Other.Controller.ConsoleCommand("setspeed 100");
                        P.bJumpCapable=False;
                        P.bCanJump=False;
                        P.bCanWalk=True;
                        P.bCanDoubleJump=False;
                        P.bWeaponBob=False;
                        P.AirSpeed=100.000000;
                        P.AccelRate=5012.000000;
                        P.AirControl=1.000000;
                        P.MaxFallSpeed=2500.000000;
                        P.Health=100;
                        P.mass=100;
                        P.GroundSpeed=100;
                        FluidFriction=0.5;
                        GroundFriction=0.5;
                        TerminalVelocity=2500.000000;
                        }
                        // Nothing much here.
                        event PawnEnteredVolume(Pawn Other)
                        {
                        local Pawn P;
                        local vector vehiclespawnlocation;
                        P = Other;

                        // P.velocity.Y = 300;
                        // vehiclespawnlocation = P.Location;
                        // vehiclespawnlocation.Y = vehiclespawnlocation.Y + 100.0;
                        // Spawn(class'Bulldog',,,vehiclespawnlocation);
                        // P.Controller.ConsoleCommand("SAY Spawned a Vehicle in Earth Orbit");

                        }

                        // this function is executed every second so lets hack gravity into it
                        // this is Unreal Script so we have to use what we can override :>

                        function CausePainTo(Actor Other)
                        {
                        local float depth;
                        local Pawn P;
                        local vector Diff;
                        local float Magnitude,Strength,VelocityMagnitude;

                        // this function executes once a second and changes the gravity to
                        point
                        // from the player to the middle of the volume. So it acts like
                        the
                        // middle of the volume is the center of gravity.
                        // Place this volume at the center of planets or moons
                        // make sure all other level gravity is set to 0.
                        // To turn gravity on or off use bCenterGravity in UED
                        // This won't work if bPainCausing != True
                        // bGravityFactor lets you change how strong gravity is in UED;

                        depth = 1;
                        P = Pawn(Other);

                        if ( bCenterGravity == True )
                        {
                        if ( Region.Zone.bSoftKillZ && (Other.Physics != PHYS_Walking) )
                        return;
                        Other.TakeDamage(int(DamagePerSec * depth), None, Location, vect(0,0,0),
                        DamageType);
                        if ( (P != None) && (P.Controller != None) )
                        {

                        Diff = (Location - P.Location );
                        Diff = Normal( Diff );
                        Magnitude = VSize(P.Location - Location);

                        Gravity =
                        Diff*10000*10000/(Magnitude*Magnitude)*bGravityFactor;
                        Strength = VSize(Gravity);
                        VelocityMagnitude = VSize (P.Velocity);

                        P.Controller.ConsoleCommand("SAY Distance to Earth is
                        "$Magnitude);
                        P.Controller.ConsoleCommand("SAY Strength of Gravity is
                        "$Strength);
                        P.Controller.ConsoleCommand("SAY Player Velocity is
                        "$P.Velocity);
                        P.Controller.ConsoleCommand("SAY Player Speed is
                        "$VelocityMagnitude);
                        P.Controller.ConsoleCommand("********************* ******");

                        P.Velocity.Z = P.Velocity.Z * 0.1; //put in to simplify
                        orbiting
                        P.Velocity.X = P.Velocity.X * 1.01; //put in to account for
                        slowdown
                        P.Velocity.Y = P.Velocity.Y * 1.01; //put in to account for
                        slowdown
                        P.bJumpCapable=False;
                        P.bCanJump=False;
                        P.bCanWalk=True;
                        P.bCanDoubleJump=False;
                        P.bWeaponBob=False;
                        P.AirSpeed=1000000.000000;
                        P.AccelRate=5012000.000000;
                        P.AirControl=1.000000;
                        P.MaxFallSpeed=25000000.000000;
                        P.Health=562;
                        P.mass=1000;
                        P.GroundSpeed=10000000;
                        FluidFriction=0;
                        GroundFriction=0;
                        TerminalVelocity=25000.000000;
                        }
                        }

                        }

                        defaultproperties
                        {
                        DieFOV=150.000000
                        DamageType=Class'Gameplay.Depressurized'
                        bStatic=False
                        bHidden=False
                        bCenterGravity=True
                        bPainCausing=True
                        bGravityFactor=100;
                        Gravity=(Z=0.000000);
                        GroundFriction=0;
                        FluidFriction=0;
                        TerminalVelocity=2500000;
                        }

                        Comment


                          #13
                          That script doesn't look like it rotates the player model so they can actually WALK on the surface though.

                          Comment


                            #14
                            Angel,

                            Thats not necassary in our case since when the space ship gets close to the earth it triggers an event that warps the player to another place in the map where entry through the atmosphere is simulated.

                            Its not like the player needs to walk around the earth .

                            But if you did need the player to walk on the sphere you could try to code it however once a second is probably not enough to update the player position. If so it would have to moved to tick(). And then it may increase CPU use on the server with alot of players. And sense this is not being done in C++ but in script it might be a slow calculation.

                            So perhaps one might try to switch the player to spidering when he gets close.....

                            Comment

                            Working...
                            X