Results 1 to 26 of 26
  1. #1

    Default Walking on a wall

    In my game player can walk on walls by holding cpecial button - but it only idea, i don't know how realize it in UnrealScript

    P.S. It TPS Game
    P.P.S. Sorry for my bad english

  2. #2
    MSgt. Shooter Person
    Join Date
    Nov 2007
    Location
    The Netherlands
    Posts
    373
    Gamer IDs

    Gamertag: LennardF1989

    Default

    You could literally port over the PHYS_Spider code of UT2003. You only have to comment away the not-compilable lines to make it work, as far as I can remember.
    Last edited by LennardF1989; 01-06-2010 at 05:25 PM.

  3. #3

    Default

    What is "PHYS_Spyder" - this is mutator/mod or something else? Correct me if I have incorrectly understood you
    Last edited by AlexSmart; 01-06-2010 at 05:48 PM.

  4. #4
    Iron Guard
    Join Date
    Nov 2006
    Posts
    712

    Default

    PHYS_Spider is one of the basic physics states for actors. You can see them all in the EPhysics declaration in Actor.uc

    There is some basic functionality built in, to let the player 'walk on walls', using PHYS_Spider, but it has never been fully implemented in any of the UT games, so you will have to figure out a lot for yourself.

  5. #5

    Default

    So, i think im on right way...
    I find "PHYS_Spider" in actor.uc, but i not completly understand how it use...
    ...In UTGame defafalt mode when player pressing "F", activated PHYS_Falling - i tried to simple replace PHYS_Falling and PHYS_Spider... but fail...

  6. #6
    Iron Guard
    Join Date
    Nov 2006
    Posts
    712

    Default

    You would have to use SetPhysics(PHYS_Spider) rather than setting the Physics variable directly... But i'm not sure just setting they physics mode will do much.. There is likely a bit more work that would need to be done before you get something half-ways like you want, and you are unlikely to find any real documentation on what that entails.

  7. #7
    Iron Guard
    Join Date
    Dec 2009
    Location
    Kirkcaldy, Scotland
    Posts
    832

    Default

    Id love to see someone get this working, seems to come up a couple times a week

  8. #8
    MSgt. Shooter Person
    Join Date
    Jan 2010
    Location
    Germany
    Posts
    320

    Default

    yeah, AvP feeling *g*

  9. #9
    MSgt. Shooter Person
    Join Date
    Nov 2007
    Location
    The Netherlands
    Posts
    373
    Gamer IDs

    Gamertag: LennardF1989

    Default

    I already said how you can get it to work in the second post... You can literally port the UT2003 code, comment away the uncompilable lines and it works. I still have a video of it somewhere proving it really works.



    Disclaimer: This was a WIP of a mod I was working on, I think it died somewhere down the line for UT3 and I'm not sure what became of it now. Do not ask me about it. Technically I'm not even supposed to show this video.
    Last edited by LennardF1989; 01-07-2010 at 09:38 AM.

  10. #10
    Veteran
    Join Date
    Sep 2006
    Location
    Newcastle, UK
    Posts
    6,942
    Gamer IDs

    Gamertag: ambershee

    Default

    This is my version. It has collision issues that I never solved. If you use it, then stick to the condition, and please post here and update it with any fixes you add.

    Code:
    state PlayerSpidering
    {
    ignores SeePlayer, HearNoise, Bump;
    
        event bool NotifyHitWall(vector HitNormal, actor HitActor)
        {
            Pawn.SetPhysics(PHYS_Spider);
            Pawn.SetBase(HitActor, HitNormal);
            return true;
        }
    
        // if spider mode, update rotation based on floor
        function UpdateRotation(float DeltaTime)
        {
            local rotator ViewRotation;
            local vector MyFloor, CrossDir, FwdDir, OldFwdDir, OldX, RealFloor;
    
            if ( (Pawn.Base == None) || (Pawn.Floor == vect(0,0,0)) )
                    {
                MyFloor = vect(0,0,1);
                    }
            else
                    {
                MyFloor = Pawn.Floor;
                    }
            if ( MyFloor != OldFloor )
            {
                // smoothly transition between floors
                RealFloor = MyFloor;
                MyFloor = Normal(6*DeltaTime * MyFloor + (1 - 6*DeltaTime) * OldFloor);
    
                            if ( (RealFloor dot MyFloor) > 0.999 )
                            {
                    MyFloor = RealFloor;
                            }
                            else
                            {
                                    // translate view direction
                                    CrossDir = Normal(RealFloor Cross OldFloor);
                                    FwdDir = CrossDir cross MyFloor;
                                    OldFwdDir = CrossDir cross OldFloor;
                                    ViewX = MyFloor * (OldFloor dot ViewX) + CrossDir * (CrossDir dot ViewX) + FwdDir * (OldFwdDir dot ViewX);
                                    ViewX = Normal(ViewX);
                                    ViewZ = MyFloor * (OldFloor dot ViewZ) + CrossDir * (CrossDir dot ViewZ) + FwdDir * (OldFwdDir dot ViewZ);
                                    ViewZ = Normal(ViewZ);
                                    OldFloor = MyFloor;
                                    ViewY = Normal(MyFloor cross ViewX);
    
                                    Pawn.mesh.SetRotation(OrthoRotation(ViewX,ViewY,ViewZ));
                            }
            }
    
            if ( (PlayerInput.aTurn != 0) || (PlayerInput.aLookUp != 0) )
            {
                // adjust Yaw based on aTurn
                if ( PlayerInput.aTurn != 0 )
                            {
                    ViewX = Normal(ViewX + 2 * ViewY * Sin(0.0005*DeltaTime*PlayerInput.aTurn));
                            }
    
                // adjust Pitch based on aLookUp
                if ( PlayerInput.aLookUp != 0 )
                {
                    OldX = ViewX;
                    ViewX = Normal(ViewX + 2 * ViewZ * Sin(0.0005*DeltaTime*PlayerInput.aLookUp));
                    ViewZ = Normal(ViewX Cross ViewY);
    
                    // bound max pitch
                    if ( (ViewZ dot MyFloor) < 0.707   )
                    {
                        OldX = Normal(OldX - MyFloor * (MyFloor Dot OldX));
                        if ( (ViewX Dot MyFloor) > 0)
                                            {
                            ViewX = Normal(OldX + MyFloor);
                                            }
                        else
                                            {
                            ViewX = Normal(OldX - MyFloor);
                                            }
    
                        ViewZ = Normal(ViewX cross ViewY);
                    }
                }
    
                // calculate new Y axis
                ViewY = Normal(MyFloor cross ViewX);
            }
            ViewRotation =  OrthoRotation(ViewX,ViewY,ViewZ);
            SetRotation(ViewRotation);
            Pawn.FaceRotation(ViewRotation, deltaTime );
    
                    //SET PAWN ROTATION WITH RESPECT TO FLOOR NORMALS HERE
                    //Pawn.mesh.SkeletalMesh.Rotation = Pawn.Rotation;
    
        }
    
        function bool NotifyLanded(vector HitNormal, Actor FloorActor)
        {
            Pawn.SetPhysics(PHYS_Spider);
            return bUpdating;
        }
    
        event NotifyPhysicsVolumeChange( PhysicsVolume NewVolume )
        {
            if ( NewVolume.bWaterVolume )
                    {
                GotoState(Pawn.WaterMovementState);
                    }
        }
    
        function ProcessMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot)
        {
            if ( Pawn.Acceleration != NewAccel )
                    {
                            Pawn.Acceleration = NewAccel;
                    }
    
            if ( bPressedJump )
                    {
                Pawn.DoJump(bUpdating);
                    }
        }
    
        function PlayerMove( float DeltaTime )
        {
            local vector NewAccel;
            local eDoubleClickDir DoubleClickMove;
            local rotator OldRotation, ViewRotation;
            local bool  bSaveJump;
    
            GroundPitch = 0;
            ViewRotation = Rotation;
    
            //Pawn.CheckBob(DeltaTime,vect(0,0,0));
    
            // Update rotation.
            SetRotation(ViewRotation);
            OldRotation = Rotation;
            UpdateRotation(DeltaTime);
    
            // Update acceleration.
            NewAccel = PlayerInput.aForward*Normal(ViewX - OldFloor * (OldFloor Dot ViewX)) + PlayerInput.aStrafe*ViewY;
    
                    if ( VSize(NewAccel) < 1.0 )
                    {
                NewAccel = vect(0,0,0);
                    }
    
            if ( bPressedJump && Pawn.CannotJumpNow() )
            {
                bSaveJump = true;
                bPressedJump = false;
            }
            else
                bSaveJump = false;
    
            ProcessMove(DeltaTime, NewAccel, DoubleClickMove, OldRotation - Rotation);
            bPressedJump = bSaveJump;
        }
    
        event BeginState(Name PreviousStateName)
        {
            //if ( Pawn.Mesh == None )
            //    Pawn.SetMesh();
            OldFloor = vect(0,0,1);
            GetAxes(Rotation,ViewX,ViewY,ViewZ);
            DoubleClickDir = DCLICK_None;
            Pawn.ShouldCrouch(false);
            bPressedJump = false;
    
            if (Pawn.Physics != PHYS_Falling)
                    {
                Pawn.SetPhysics(PHYS_Spider);
                    }
    
                    GroundPitch = 0;
            Pawn.bCrawler = true;
        }
    
        event EndState(Name NextStateName)
        {
            GroundPitch = 0;
            if ( Pawn != None )
            {
                Pawn.ShouldCrouch(false);
                Pawn.bCrawler = Pawn.default.bCrawler;
            }
        }
    }

  11. #11

    Default Code location

    I'm sorry if this seems like a dumb question to ask, but ambershee, where exactly would I place that code of yours so I can try it out? Any help would be fantastic. Thank you very much.

  12. #12
    Veteran
    Join Date
    Sep 2006
    Location
    Newcastle, UK
    Posts
    6,942
    Gamer IDs

    Gamertag: ambershee

    Default

    It's a movement state for a player controller class.

  13. #13

    Default

    I really appreciate you getting back to me on this, especially so quickly. I hate to pester you again, but unfortunately that was just a bit too vague for me (I'm just beginning to figure our how UDK handles is scripts and everything...) could you maybe specify a file name and/or where to place it? Thanks again.

  14. #14
    MSgt. Shooter Person
    Join Date
    May 2010
    Location
    null
    Posts
    115

    Default

    What he means is you place that in the class you made like myplayercontrollerclass.uc.
    Create a file and extend off of utplayercontroller and place those states in. Ambershee thats pretty cool reminds me of ratchet and clank

  15. #15
    Veteran
    Join Date
    Sep 2006
    Location
    Newcastle, UK
    Posts
    6,942
    Gamer IDs

    Gamertag: ambershee

    Default

    Quote Originally Posted by Gavin.Race View Post
    I really appreciate you getting back to me on this, especially so quickly. I hate to pester you again, but unfortunately that was just a bit too vague for me (I'm just beginning to figure our how UDK handles is scripts and everything...) could you maybe specify a file name and/or where to place it? Thanks again.
    Follow some introductory tutorials, work with Unreal a bit and then come back to it - the code itself is reasonably complicated but easy to implement.

    You don't just drop code into existing files, this is a very wrong approach.

  16. #16

    Default

    Spitfire thank you very much, that's exactly what I needed. Thanks again ambershee

  17. #17

    Default OldFloor?

    So strangely, it doesn't like a few lines regarding "OldFloor", though I can't see why. Did you declare OldFloor somewhere other than this script? As far as I know it should be an internal variable already...

    Code:
    (163) : Error, 'OldFloor': Bad command or expression
    (140) : Error, Bad or missing expression after '-': 'OldFloor'
    (28) : Error, Bad or missing expression after '!=': 'OldFloor'
    I know you wrote this a while back, so I appreciate you revisiting this with me.

  18. #18

    Default

    Well I was able to resolve the compiler errors (except for a warning or two), however the script does not seem to take effect no matter what I do... Oh well, thanks for the help you guys

  19. #19
    Veteran
    Join Date
    Sep 2006
    Location
    Newcastle, UK
    Posts
    6,942
    Gamer IDs

    Gamertag: ambershee

    Default

    It doesn't work immediately out of the box, the player has to actually enter that movement state somewhere along the lines.

    Edit: OldFloor is probably a global vector variable.

  20. #20

    Default

    Ya I was thinking about that once I read through your code more closely. So technically I just need to find a way to initiate PlayerSpidering. Is there an activate state function I can call after an event or something?

    And once I declared that OldFloor was a vector variable, it compiled fine.

  21. #21
    MSgt. Shooter Person
    Join Date
    May 2010
    Location
    null
    Posts
    115

    Default

    What you could do is bind a key to go to the state of spider walking.
    Take a look at triggering states http://udn.epicgames.com/Three/Maste...iptStates.html

  22. #22

    Default

    Ya I was just checking out that page actually. I'll have to figure out what kind of event will work out best. I just need to figure out the syntax since I'm not super familiar with it, but I'll get it. Thanks again for all your help guys, my game class and I thank you.

  23. #23

    Default

    Well just when I thought I figured out what should work, every kind of initiation of a change state I've tried to set up has done nothing. I totally agree that this is way beyond me, but I'm doing this for a class. So try not to reprimand me too much if this is a completely stupid question, but is there anything I need to do other than having a certain event call a GotoState()? Or even perhaps it being an auto state or SetInitialState; I just want to see the state actually change...

    P.S. I am learning quite a bit due to the flooding this has caused (as opposed to really starting from the beginning), so thanks for all your help again.

  24. #24
    Veteran
    Join Date
    Sep 2006
    Location
    Newcastle, UK
    Posts
    6,942
    Gamer IDs

    Gamertag: ambershee

    Default

    GoToState (or better, SetPhysics) should be all you need. Alternatively you can change the default ground movement state.

  25. #25

    Default

    So once I finally realized I needed to call the controller in my GameInfo file, it finally took effect. However, the effect it took was that it looks as if it's in spectator mode. There's no HUD, and the player flies... At least some effect finally took place, however this is not what I expected... Any ideas?

  26. #26

    Default

    Hey i just found this topic and also found it very interesting.
    I just think that there is a part of the script i need in those messages.

    When he jump in a vertical wall, my player have to stay on it, to grab it. No additionnal moves, no view changing, nothing more than just stay on it until JUMP key second utilisation.

    If someone just come here, can you help me to find the part of the script that i neeb.
    It would be very awesome.
    Thx


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.