Results 1 to 2 of 2

Hybrid View

  1. #1

    Default Movement ignoring view rotation?

    In my game I want to allow the player to move whilst ignoring the view rotation of the Pawn so say when the player presses W they run forward no matter what direction they are looking in, now I had it working before I updated to the latest version of UDK and now it is stopped.

    This is the code I was using before.

    Code:
    class MyPlayerInput extends PlayerInput;
    
    event PlayerInput( float DeltaTime )
    {	
    	local MyPawn P;
    
    	local int rot, up;
    	local Rotator MinRot, MaxRot;
    
    	rot = Rotation.Yaw;
    	up = Rotation.Pitch;
    
    	P = MyPawn(PlayerCamera.PCOwner.Pawn);
    
    	if(P != None)
        {
    		if(P.north == true)
    		{
    			aForward = -aBaseY;
    			aStrafe = -aStrafe;
    
    			MinRot.Yaw = 20000;
    			MinRot.Pitch = up;
    			MaxRot.Yaw = 40000;
    			MaxRot.Pitch = up;
    		}
        }
    
    
    
    	if(rot >= MinRot.Yaw && rot <= MaxRot.Yaw)
    	{
    
    		aTurn = aBaseX + aMouseX * 10;
    
    	}
    	if(rot <= MinRot.Yaw)
    	{
    		MinRot.Pitch = up;
    		SetRotation(MinRot);
    	}
    	if(rot >= MaxRot.Yaw)
    	{
    		MaxRot.Pitch = up;
    		SetRotation(MaxRot);
    	}
    
    	if(aLookUp == 0)
    		aLookUp = aBaseY + aMouseY * 10;	
    }
    
    DefaultProperties
    {
    }
    Any ideas how to get it working once again? Cheers

  2. #2
    MSgt. Shooter Person
    Join Date
    Dec 2009
    Location
    Indianapolis, IN
    Posts
    98
    Gamer IDs

    Gamertag: Kamikazi Karl

    Default

    Movement direction is handelled in the playercontroller states. You need to change the code within the PlayerWalking state. It is possible to move the player independent of the camera rotation.


 

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.