Announcement

Collapse
No announcement yet.

Pawn Wall walking and directional gravity

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

  • replied
    I found this thread and i think the problem that mwadelin had is related to the bounding box, right now im having the same issue, maybe together we can find the problem that we have with pawns that are trying to walk on walls.
    this is also my thread.

    http://forums.epicgames.com/threads/...with-pawn-axis

    Leave a comment:


  • replied
    Hi mwadelin,
    your code helped me a lot...
    Currently I am trying to create a first person pawn that can walk on walls.
    The cam rotation works just fine, but if I try to edit the ProcessMove function it has no effect in-game.
    do you have an idea how to override this function?
    (I am using PHYS_Spider just like you)

    My UpdateRotation Function
    Code:
    var rotator     tempRot;	
    var vector	backupFloor;
    
    function UpdateRotation( float DeltaTime )
    {
    	local MyPawn thePawn;
    	local Vector VecFloor;
    	local Rotator ViewRotation;
    	local Quat RotQuat;
    	
    	thePawn = MyPawn(Pawn);
    	
    	if(thePawn.IsJumping){
    		VecFloor = backupFloor;
    	}else{
    		VecFloor = thePawn.Floor;
    		backupFloor = thePawn.Floor;
    	}
    	tempRot.Yaw += PlayerInput.aTurn;
    	tempRot.Pitch += PlayerInput.aLookUp;
    
    	RotQuat = QuatFindBetween (vect(0,0,1), VecFloor);
    	RotQuat = QuatProduct( RotQuat, QuatFromRotator(tempRot) );
    	ViewRotation = QuatToRotator(RotQuat);
    	if (Pawn!=none){
    		Pawn.SetDesiredRotation(ViewRotation);
    	}
    	SetRotation(ViewRotation);
    	thePawn.SetRotation(ViewRotation);
    }
    I also changed alot of your other src-code an well, everything works exapt the movement (the higher the angle of the wall the slower you are walking up + on walls with the normal (X,Y,0)T you have only movement in X or Y direction but not up the wall...)

    Leave a comment:


  • replied
    Make sure to rotate the camera, and add a coordinate object that point to "true" north, so gamer doesn't get confused on which way is up.

    Leave a comment:


  • replied
    Cheers I'll have a look at this stuff tomorrow.

    Leave a comment:


  • replied
    Hello again! sorry about the delay but we are hard-working on our project and have no-time to write articles. My teammate Gallo (who created the wall-walking ability of the creature) finished the article where he explains how was done the wallwalking in our game, you can check it in:
    http://unrealmindset.wordpress.com/

    Leave a comment:


  • replied
    Well since I'm dealing with ledges it's pretty smooth (2d movement style). I wouldn't know how it'd work with more complex "surface to surface"

    Leave a comment:


  • replied
    I have to use a collision cylinder as my pawn is a bipedal character, using the skeletal mesh collision makes him bounce up and down as he walks. I'm instead trying it the flying physics way.

    toxic have you gotten your pawn to transfer smoothly to another surface? If so how are you doing it?

    Leave a comment:


  • replied
    Yes, but it's considerably more accurate when considering collision versus other vehicles or projectiles. Because of the vehicles shape, a cylinder primitive is really not suitable.

    Leave a comment:


  • replied
    Wouldn't the physics asset be more costly?

    Leave a comment:


  • replied
    Originally posted by mwadelin View Post
    See I'm having the exact same problem in using the Spider physics, the stuttering and getting stuck in places. I think its the native collision code and there's no way of getting at it to fix it.
    This may well be the cause, but in my case, the surface transitions themselves are pretty smooth. We tend to get stuck when either moving around twisting / spiral sections or on banked corners at right angles to gravity. We also risk falling off very easily when upside down, and less so when at right angles to gravity.

    Originally posted by mwadelin View Post
    What are you using for collision, I guess not the CollisionCylinder component. I've tried using a static mesh cylinder that rotates with the pawn but that's where the stuttering occurs, when the collision rotates.
    It's using a physics asset rather than a simple collision primitive or hull. I believe that if I switched it to a small cylinder, it wouldn't actually make much difference.

    Leave a comment:


  • replied
    I'm doing very well at the moment with flying physics. I only got a few problems with acceleration but I use velocity so it works very well until I move on to multiplier movement.

    Leave a comment:


  • replied
    See I'm having the exact same problem in using the Spider physics, the stuttering and getting stuck in places. I think its the native collision code and there's no way of getting at it to fix it.

    What are you using for collision, I guess not the CollisionCylinder component. I've tried using a static mesh cylinder that rotates with the pawn but that's where the stuttering occurs, when the collision rotates.

    Leave a comment:


  • replied
    I finally got around to taking a look at the old racing game prototype that was put together between January and March this year - the code I'd posted somewhere wasn't really tampered with a great deal, although we did write in our own gravity / velocity handling instead of using the default setup for pawns in order to get us moving more like the vehicle rather than a bipedal character.

    March (Track A)
    http://www.youtube.com/watch?v=QZjaFerklx8

    April (Track B)
    http://www.youtube.com/watch?v=WsTMNrjww88

    Notably, we don't have the issue of ever being offset from our intended surface, we're always glued to it quite nicely. The issue we do have however is that we occassionally stutter, or worse, get stuck or completely detached. The exact causes I've not managed to track down although I believe they're partially related to the fact that the game is to scale (the vehicle is a little larger than the Cicada and the track covers an area that only just fits into the UnrealEd world boundaries), so we might be pushing some math accuracy boundaries somewhere.

    The movement state used in the above two videos - it's hacky as it was just a rapid prototype, but you might be able to grasp how it works:
    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;
    		local BlockingVolume EdgeBlock;
    
            if (Pawn.Base == None)
    		{
                //MyFloor = vect(0,0,1); //self righting
    			
    			//FIND NEW BASE?
    		}
    		else
    		{
    			EdgeBlock = BlockingVolume(Pawn.Base);
    			
    			if (EdgeBlock != None)
    			{
    				GoToState('PlayerWalking');
    				SetTimer(0.03f, false, 'ResetSpidering');
    				CurrentVelocity *= 0.5f;
    			}
    			else
    			{
    				if (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.0015*DeltaTime*PlayerInput.aTurn));
    					}
    
    					`log(PlayerInput.ALookUp);
    					// 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 );
    			}
    		}
    	}
    
        function bool NotifyLanded(vector HitNormal, Actor FloorActor)
        {
            Pawn.SetPhysics(PHYS_Spider);
            return bUpdating;
        }
    
        event NotifyPhysicsVolumeChange( PhysicsVolume NewVolume )
        {
            if ( NewVolume.bWaterVolume )
    		{
                GotoState(Pawn.WaterMovementState);
    		}
        }
    
        function PlayerMove( float DeltaTime )
        {
            local rotator  ViewRotation;
    		local float VelocityIncrement;
    		local rotator currentRotation;
    
            GroundPitch = 0;
            ViewRotation = Rotation;
    
            // Update rotation.
            SetRotation(ViewRotation);
            UpdateRotation(DeltaTime);
    
    		//NewAccel = CurrentVelocity * (RaceInput(PlayerInput).aForward / 1900) * Normal(ViewX - OldFloor * (OldFloor Dot ViewX));
    		//Pawn.Acceleration = NewAccel;
    		
    		VelocityIncrement = RaceInput(PlayerInput).aForward;// / 100;
    		
    		if (VelocityIncrement < 0)
    		{
    			if (CurrentVelocity < -1000)
    			{
    				VelocityIncrement = 0;
    			}
    			else
    			{
    				VelocityIncrement /= BrakeRatio;
    			}
    		}
    		else if (CurrentVelocity > AccelerationCurve[3].CurrentVelocity)
    		{
    			VelocityIncrement /= AccelerationCurve[3].AccelerationRatio;
    		}
    		else if (CurrentVelocity > AccelerationCurve[2].CurrentVelocity)
    		{
    			VelocityIncrement /= AccelerationCurve[2].AccelerationRatio;
    		}
    		else if (CurrentVelocity > AccelerationCurve[1].CurrentVelocity)
    		{
    			VelocityIncrement /= AccelerationCurve[1].AccelerationRatio;
    		}
    		else if (CurrentVelocity > AccelerationCurve[0].CurrentVelocity)
    		{
    			VelocityIncrement /= AccelerationCurve[0].AccelerationRatio;
    		}
    
    		
    		if (VelocityIncrement < 0)
    		{
    			RacePawn(Pawn).BrakeLightA.SetEnabled(true);
    			RacePawn(Pawn).BrakeLightB.SetEnabled(true);
    		}
    		else
    		{
    			RacePawn(Pawn).BrakeLightA.SetEnabled(false);
    			RacePawn(Pawn).BrakeLightB.SetEnabled(false);
    		}
    		
    
    		CurrentVelocity += VelocityIncrement;
    		Pawn.Velocity = IndividualGravity + CurrentVelocity * Normal(ViewX - OldFloor * (OldFloor Dot ViewX));
    
    		//FIXME Need to do something clever, because the camera is tied to the mesh rotation, which means very funny results doing this
    		//currentRotation = Pawn.mesh.Rotation + RacePawn(Pawn).CameraRotationOffset;
    		//Pawn.mesh.SetRotation(currentRotation);
        }
    
        event BeginState(Name PreviousStateName)
        {
            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;
            }
        }
    }

    Leave a comment:


  • replied
    I've gone back to flying again myself but are really struggling with it toxic, how are you doing yours?

    @ H3ndy; its because your pawns acceleration isnt changing when your on a different surface other than the real floor. So its still trying to run as if its on the real floor.

    Change your PlayerMove() function in your controller to calc the NewAccel differently. I'm doing a side scroller so you may not want to do it this was

    Code:
    X = Vector(rot(0,0,0)); // using this as the axis going into the screen
    Z = Pawn.Floor; // the current up axis
    Y = Z cross X; // finds the Y axis from the other 2 axes
    
    // determine new acceleration
    NewAccel = CtrlY * PlayerInput.aStrafe;
    // normalise and apply acceleration rate of the pawn
    NewAccel = Pawn.AccelRate * Normal(NewAccel);
    that should start you off, but it depends on your understanding of vectors

    Leave a comment:


  • replied
    I'd still use flying physics

    Leave a comment:

Working...
X