Announcement

Collapse
No announcement yet.

Pawn Wall walking and directional gravity

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

  • replied
    I've given the static mesh cylinder is own collision now and added that line of code to remove the old collision but its still not working as I'd like. Have a look at this video:
    http://www.youtube.com/watch?v=2oph0j0FrA8

    Is it using the skeletal mesh's collision instead? And also sometimes it appears to ignore this other collision and use my cylinder instead.

    Any more ideas?

    Leave a comment:


  • replied
    again thanks guys, ill give this a go when im at the pc again

    Leave a comment:


  • replied
    But I don't know if removing collision cylinder will work for you, an alternative maybe just set the cylinder size to some value not disturbing the process.

    Btw, you can use
    SHOW COLLISION
    console command to debug.

    Leave a comment:


  • replied
    That does not remove the collision cylinder, just override its properties (which is a taller collision cylinder, i guess).
    Use:
    Code:
    Components.Remove(CollisionCylinder)

    Leave a comment:


  • replied
    Try to add the static mesh you created to your level as a rigid body, that should give you a good idea about wether or not the collission on you static mesh works. If not double click the static mesh in the content browser to open the mesh editor and try a few diffrent collision settings, auto convex will probebly do the trick.

    Leave a comment:


  • replied
    Ok Ive created a static mesh in Maya and exported as a fxb and then used your code (renderer) to set it as the collision, except I changed the HiddenGame var to false so I could see what it was doing. If you check the video out you can see the problems its causing:
    http://www.youtube.com/watch?v=yNcvxGs1Zlc

    First and foremost the collision cylinder appears not be touching anything at all and therefore I think its not being used as the collision component for the pawn.

    Secondly whatever the pawn is using it appears to make it levitate off of the floor.

    I have removed the default collision before anyone asks, its commented out here and replaced with the new stuff underneath it.
    Code:
    /*	Begin Object Name=CollisionCylinder
    		CollisionRadius=+0023.000000
    		CollisionHeight=+0050.000000
    	End Object
    	CylinderComponent=CollisionCylinder
    */
    
    	Begin Object class=StaticMeshComponent Name=StaticMeshCylinder
    	StaticMesh=StaticMesh'GGame.GPawnCylinder'
    	HiddenGame=False
    	End Object
    	Components.Add(StaticMeshCylinder)
    	CollisionComponent=StaticMeshCylinder
    
    	CollisionType=COLLIDE_BlockAll
    Any ideas?

    Leave a comment:


  • replied
    cheers renderer ill try that later when im at my desktop

    Leave a comment:


  • replied
    I think I've got a selution for the feet going throug the wall problem: You can change the CollisionComponent to somthing other than a CylinderComponent, for example a StaticMeshComponent.
    Save the StaticMesh you want to use in the Content Browser and add somthing like the following code to the defaultproperties of your pawn class:

    Begin Object class=StaticMeshComponent Name=StaticMeshCylinder
    StaticMesh=StaticMesh'MyPawn.SMCylinder'
    HiddenGame=TRUE
    End Object
    Components.Add(StaticMeshCylinder)
    CollisionComponent=StaticMeshCylinder

    PS: in this case the package is called 'MyPawn' end the StaticMesh is called 'SMCylinder'

    Leave a comment:


  • replied
    the bit that makes him stick to the ceiling (or what ever surface he collides with) is this
    Code:
    // called when the pawn lands or hits another surface
    event HitWall(Vector HitNormal,Actor Wall, PrimitiveComponent WallComp)
    {
    	// back to normal
    	GotoState('');
    }
    This code is found within the Pawn inside its 'PawnFalling' state. This simply stops the gravity code and sticks the pawn back to the surface.

    But in order to make the above HitWall function work you need to set bDirectHitWall = true
    Code:
    event BeginState(Name PrevState)
    {
    	bDirectHitWall = true;
    
    	SetPhysics(PHYS_Flying);
    }
    and then when exiting the state....
    Code:
    event EndState(Name NextState)
    {
    	bDirectHitWall = false; 
    	SetPhysics(PHYS_Spider); // "Glue" back to surface
    }
    You may not want yours to work like that though, if not all you need to do is make sure that while your pawn is "falling" or in the air is that the physics is set to PHYS_Flying and the bDirectHitWall is set to true.

    Then use the HitWall event function to put the physics back to spider and set bDirectHitWall back to false.

    Other than that I would need to see your code to help you further.

    Leave a comment:


  • replied
    @mwadelin: I followed that tutorial you posted, however i am having difficulty getting to work as you got it.

    My player jumps when the space-bar is pressed and collides with the roof, when this occurs the player falls straight back down to the ground. I cannot seem to get him stuck onto the roof moving (whether that be with his head or feet). I havent changed any of your code, and implemented it correctly as far as i can tell (no errors). I am using the UT2D code base, however no conjunction errors appear to be occuring.

    The player has the spider physics, something I cannot see (I have tried for a few hours now) is causing this.

    Any help with this or expansion on your gravity changing would be much appreciated.

    Leave a comment:


  • replied
    Thanks man. I use accel variable from move function. Now working.

    Leave a comment:


  • replied
    Yeah. When used as a pawn works but does not work when used as mPawn. I think editing is done in lower classes. I'll try to investigate and resolve. If anyone know please help me.

    Leave a comment:


  • replied
    As far as I can tell your movement code should work but this part may not be working:
    Code:
    simulated event PostBeginPlay()
    {
    	local SuperPawn sPawn;
    
    	super.PostBeginPlay(); 
    	foreach WorldInfo.AllPawns(class'SuperPawn',sPawn)
    	{
    		mPawn = sPawn;
    		break;
    	}
    }
    When you run the game either look in the log afterwards or enable the log window and check that there are no errors that say something like this "Error accessed none mPawn....."

    For now just access the pawns acceleration var like this
    Code:
    Pawn.Acceleration = NewAccel;
    Your PlayerController class should be assigned your pawn already via your GameInfo class and stored in a var called Pawn. So the above code should make it work, otherwise I don't know whats causing the problem.

    Leave a comment:


  • replied
    Thanks mwadelin,
    Code:
    function ProcessMove( float DeltaTime, vector newAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot)
    {
        if( (Pawn != None) && (Pawn.Acceleration != newAccel) )
    	{
    		Pawn.Acceleration = newAccel;
    	}
    }
    Yeah. Like you said. Other parameters dont use excluding newAccel. But again dont move my pawn. I spawned from editor. Look at my codes:
    Code:
    class SuperPlayerController extends PlayerController;
    
    var SuperPawn mPawn;
    
    simulated event PostBeginPlay()
    {
    	local SuperPawn sPawn;
    
    	super.PostBeginPlay(); 
    	foreach WorldInfo.AllPawns(class'SuperPawn',sPawn)
    	{
    		mPawn = sPawn;
    		break;
    	}
    }
    
    state ReadKeys
    {
    	function PlayerMove( float DeltaTime )
    	{
    		Local Vector NewAccel;
    
    		NewAccel = Vect(1,0,0);         //move x axses 1 unit
    		NewAccel = mPawn.AccelRate * Normal(NewAccel);
    		mPawn.Acceleration = NewAccel;  //in process move function
    	}
    }
    
    auto state PlayerWaiting
    {
    Begin:
    	GotoState('ReadKeys');
    }
    
    DefaultProperties
    {
    	CameraClass = class'SuperCamera'
    }
    I add this line from my pawn class:
    Code:
    bRollToDesired=true

    Leave a comment:


  • replied
    Do you see the NewAccel vector that is passed to ProcessMove() ?

    These parts:
    Code:
    NewAccel = PlayerInput.aForward*AxisZ + PlayerInput.aStrafe*AxisY;
    
    NewAccel = Pawn.AccelRate * Normal(NewAccel);
    
    ProcessMove(DeltaTime, NewAccel, DoubleClickMove, Rotation);
    The NewAccel is the direction you make your pawn move in in the world axes. So if NewAccel = vect(1,0,0) your pawn would move 1 unit in the positive X axis.

    Set your NewAccel initially to what ever direction you want it to go, and then use the second line of code to make it use the pawns own AccelRate. Finally you then pass it to ProcessMove().

    If you look in the ProcessMove() function within PlayerController or UDKPlayerController you'll probably find that depending on the state ProcessMove() doesnt really use the DoubleClickMove and Rotation vars passed to it so you can simply create your own locally within the PlayerMove() function and leave them unassigned like I did earlier in the thread.

    Leave a comment:

Working...
X