Announcement

Collapse
No announcement yet.

Pawn Wall walking and directional gravity

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

  • replied
    I've tried enabling that, it doesnt do anything. My pawns physics is set to PHYS_Spider that might be why but I've tried it with PHYS_Walking too, still no effect.

    EDIT: I feel that someone must know how to do this; Orientate the pawn so that its feet are on the surface using the normal of that surface from Pawn.Floor?

    Because obviously my

    BaseRot = Rotator(Pawn.Floor);
    BaseRot.Pitch -= 16384;

    doesnt work properly.

    Leave a comment:


  • replied
    what about bCrawler in the Pawn class?

    Leave a comment:


  • replied
    Well my base rotation is calculated using the floor normal.

    BaseRot = Rotator(Pawn.Floor);
    BaseRot.Pitch -= 16384;

    How does your sonic GDK do it, as I guess you pawn uses the surface normal to orientate itself.

    Leave a comment:


  • replied
    I guess it's a coincidence. Note that the red and green lines aren't facing the correct directions anyways.

    You have to get a correct base rotation from floor vector and camera face rotation.

    Leave a comment:


  • replied
    But when I remove the additional quaternion stuff like so:
    Code:
    	/** This adjusts the pawns rotation so that it stands on the surface it is on */
    	function UpdateRotation( float DeltaTime )
    	{
    		local Rotator   NewRot, DeltaRot;
    		local Vector    X, Y, Z;
    
    		// this is the base rotation of being on any surface
    		NewRot = Rotator(Pawn.Floor);
    		NewRot.Pitch -= DEG90; // aligns the pawns feet to the surface
    
    		// get the local axes of the pawn
    		GetAxes(NewRot, X, Y, Z);
    
    		DrawDebugCoordinateSystem(Pawn.Location,  NewRot, 200.0f, false);
    
    		DeltaRot = OldDeltaRot; // assign the olddelta rotation
    
    		// process mouse input
    		if(PlayerInput.aMouseX > 0)
    			DeltaRot.Yaw += 1000;
    		else if(PlayerInput.aMouseX < 0)
    			DeltaRot.Yaw -= 1000;
    		
    		// THIS DOESN WORK (and I dont understand why as this is what I've used in XNA before)
    		/*NewRot = QuatToRotator( QuatProduct(
                                          QuatFromAxisAndAngle(Z, UnrRotToRad * DeltaRot.Yaw),
                                          QuatFromRotator(NewRot)
                                    ) );*/
    
    		Pawn.SetRotation(NewRot);
    
    		OldDeltaRot = DeltaRot;
    	}
    The pawn orientates to the floor fine, but obviously now I cant do the additional rotation.
    http://www.youtube.com/watch?v=WPKQoR5XFU8

    EDIT: WHAT AM I DOING WRONG LOL!

    Leave a comment:


  • replied
    It does work (the quaternion stuff); the pawn is rotated around the blue axis.

    The problem you have is caused by the initial values you give to NewRot, which are wrong.

    Leave a comment:


  • replied
    Ok I've tried that and I'm getting the problem I had when I tried using Quaternions before.

    Heres whats happening, I've made it so it draws a coordinate system showing the axes:
    http://www.youtube.com/watch?v=pAf0TnWjuSI

    Code:
    	function UpdateRotation( float DeltaTime )
    	{
    		local Rotator   NewRot, DeltaRot;
    		local Vector    X, Y, Z;
    
    		// this is the base rotation of being on any surface
    		NewRot = Rotator(Pawn.Floor);
    		NewRot.Pitch -= DEG90; // aligns the pawns feet to the surface
    
    		// get the local axes of the pawn
    		GetAxes(NewRot, X, Y, Z);
    
    		DrawDebugCoordinateSystem(Pawn.Location,  NewRot, 200.0f, false);
    
    		DeltaRot = OldDeltaRot; // assign the olddelta rotation
    
    		// process mouse input
    		if(PlayerInput.aMouseX > 0)
    			DeltaRot.Yaw += 1000;
    		else if(PlayerInput.aMouseX < 0)
    			DeltaRot.Yaw -= 1000;
    		
    		// THIS DOESN WORK (and I dont understand why as this is what I've used in XNA before)
    		NewRot = QuatToRotator( QuatProduct(
                                          QuatFromAxisAndAngle(Z, UnrRotToRad * DeltaRot.Yaw),
                                          QuatFromRotator(NewRot)
                                    ) );
    
    		Pawn.SetRotation(NewRot);
    
    		OldDeltaRot = DeltaRot;
    	}
    I'm at a loss here

    Leave a comment:


  • replied
    I tried messing with Quaternions earlier to no success but I will try your method later when I'm on the desktop. Cheers

    Leave a comment:


  • replied
    Apply turning with a quaternion.

    Code:
    out_ViewRotation = QuatToRotator( QuatProduct(
                                          QuatFromAxisAndAngle(Z, UnrRotToRad * out_DeltaRot.Yaw),
                                          QuatFromRotator(out_ViewRotation)
                                    ) );
    //where: out_ViewRotation is the current rotation;
    //       Z is "up" axis (unit vector) of current rotation;
    //       out_DeltaRot.Yaw has the desired turning amount.

    Leave a comment:


  • replied
    yeah Ive seen something you posted on another thread and tried to use it but I dont understand it.

    Im not after a quick and easy solution so if you're willing to teach me some vector math (as ive forgotten most of it from a level math) I would be very greatful. Or point me to resource to learn from? Thanks

    Leave a comment:


  • replied
    I know what you're getting at, and have written an example of this before - but unfortunately it is not a simple solution at all, it involves vast quantities of vector math to get it working vaguely correctly.

    Leave a comment:


  • replied
    Can any body help me with this its driving me mad!!!!!

    All I need is to work out how to spin the player when hes on any surface

    Leave a comment:


  • replied
    Ah I see, so thats how you get the local axis which is great. How do I then rotate my pawn about the local "up" axis?

    Leave a comment:


  • replied
    native(229) static final function GetAxes ( rotator A, out vector X, out vector Y, out vector Z );

    Leave a comment:


  • replied
    It doesnt work as far as I can tell because of the way the pawns rotated.

    When you are on the floor the Yaw would be the pawns Z axis as shown here


    When you are on a wall the Yaw would be the Y axis

    EDIT: Ignore the fact that hes half burred in the wall (a separate bug)

    I suppose I could hardcode a definite rotation for of the 6 faces of a square room but the idea was just to use the floor normal so that the player can be orientated on any surface whose normal is at any angle.

    Does anyone get what I'm getting at?

    Leave a comment:

Working...
X