Announcement

Collapse

The Infinity Blade Forums Have Moved

We've launched brand new Infinity Blade forums with improved features and revamped layout. We've also included a complete archive of the previous posts. Come check out the new Infinity Blade forums.
See more
See less

Pawn appears in the air

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

  • Pawn appears in the air

    Hello everybody,

    Using unrealscript I spawn my pawn in an environment (UDKPawn that comes with UDK)
    The pawn stays in the air when it appears in the environment, and it will only fall on the ground if I ask him to move to a location (MoveTo).
    After falling on the ground it won't move either, even if I send the command again and again it won't move.

    I think I have some issue with the physics when declaring the DefaultProperties of the pawn.

    Is this something you ran into before?


    Thanks !

  • #2
    If we're talking AI Controlled pawns, try calling SetMovementPhysics() before telling it to move the first time.

    Comment


    • #3
      Originally posted by Blade[UG] View Post
      If we're talking AI Controlled pawns, try calling SetMovementPhysics() before telling it to move the first time.
      Thanks for the reply.
      I have already done that, not sure if I'm calling it before sending the command (will check tonight).

      How about the pawn being stuck in the air when I first spawn it. Something to do with the physics?
      I'll try to post my code here as well later on.

      Thanks

      Comment


      • #4
        Even when you move around it's floating in the air? Or when you first spawn it's floating in the air?

        If it's just always floating in the air, check your collision object in your pawn's defaultproperties.

        For example, this is the one for UTPawn, and I think it's the default one too.
        Code:
        Begin Object Name=CollisionCylinder
        	CollisionRadius=+0021.000000
        	CollisionHeight=+0044.000000
        End Object
        Hope this helps. ^_^

        Comment


        • #5
          @Saucy
          The pawn still appears in the air when I spawn it.

          Here are the different codes for 3 classes I have:
          USARAvatarCommon: Super class for avatars (pawns)
          USARAvatarMaleA: Subclass of USARAvatarCommon specific for a pawn (This is where I define the skeletal mesh)
          USARAIController: Controller for USARAvatarCommon


          USARAvatarCommon

          Code:
          /*
           * USARAvatarCommon: Superclass handling functions for avatars
           */
          
          
          class USARAvatarCommon extends UDKPawn;
          
          
          simulated event PostBeginPlay()
          {
            super.PostBeginPlay();
            SpawnDefaultController();
            `Log("Pawn is alive !");
          }
          
          
          function SpawnDefaultController()
          {
            LogInternal("USARAvatarCommon::SpawnDefaultController");
            ControllerClass=Class'USARAvatar.USARAIController';
            Super.SpawnDefaultController();
          }
          
          
          DefaultProperties
          {
          ControllerClass=class'USARAvatar.USARAIController'
          // Components.Remove(Sprite) Begin Object Class=DynamicLightEnvironmentComponent Name=AvatarLightEnvironment
          ModShadowFadeoutTime=0.25 MinTimeBetweenFullUpdates=0.2 AmbientGlow=(R=.01,G=.01,B=.01,A=1) AmbientShadowColor=(R=0.15,G=0.15,B=0.15) bSynthesizeSHLight=TRUE
          End Object }
          USARAvatarMaleA

          Code:
          /*
           * USARAvatarMaleA: Subclass of USARAvatarCommon
           */
          class USARAvatarMaleA extends USARAvatarCommon placeable;
          
          
          DefaultProperties
          {
           Begin Object class=SkeletalMeshComponent Name=UDKBotSkeletalMesh
                 SkeletalMesh=SkeletalMesh'CH_IronGuard_Male.Mesh.SK_CH_IronGuard_MaleA'
                 AnimSets(0)=AnimSet'CH_AnimHuman.Anims.K_AnimHuman_BaseMale'
                 AnimTreeTemplate=AnimTree'CH_AnimHuman_Tree.AT_CH_Human'
                 HiddenGame=FALSE
                 HiddenEditor=FALSE
                 Scale = 1.3975
                 // This raises the mesh so the feet arent passing through the floor
                 //Translation=(Z=20)
                 BlockNonZeroExtent=true
                 BlockZeroExtent=true
                 BlockActors=true
                 CollideActors=true
           End Object
           
             Begin Object Name=CollisionCylinder
              CollisionRadius=+0021.000000
              CollisionHeight=+0044.000000
              BlockZeroExtent=FALSE
            End Object
          
          
           //-- AvatarLightEnvironment is defined in the class USARAvatarCommon
           Components.Add(AvatarLightEnvironment)
           Mesh=UDKBotSkeletalMesh
           Components.Add(UDKBotSkeletalMesh)
           bJumpCapable=false
           bCanJump=false
           GroundSpeed=100.0
          }
          USARAIController
          - Some functions and state are not implemented yet.
          - MoveForwardToLocation is called from another script, which I didn't post here

          Code:
          class USARAIController extends AIController;
          
          
          var Vector position;
          
          
          
          
          /** Move an avatar towards a location
          type is the type of action and can take the following values:
               - walkf: walk forward
               - walkb: walk backward
               - run: run
          
          
          pos is the location (x,y,z) that the avatar is asked to reach
          
          
          action is the type of action applied on the new location to reach, and can take the following values:
                 - new: Ask the avatar to move to the new location
                 - pause: Pause the current action the avatar is performing
                 - resume: Resume the action performed by the avatar before being paused
                 - append: Add a new location to a list of locations
          */
          function MoveForwardToLocation(String type, Vector pos, String action)
          {
            //`log(pos);
            //`log(action);
            //`log("+++++ Moving Pawn to location ++++++");
          
          
            position=pos;
          
          
            //-- Location that the avatar has to reach immediately
            if (action=="new")
            {
              `log("+++++ New Command ++++++");
              PushState('WalkToLocationState');
            }
            //-- Pause the current action the avatar is performing
            else if (action=="pause")
            {
              `log("+++++ Pause Command ++++++");
            }
            //-- Resume the action the avatar was performing before being paused
            else if (action=="resume")
            {
              `log("+++++ Resume Command ++++++");
            }
            //-- Add the location pos to a list of locations
            else if (action=="append")
            {
              `log("+++++ Append Command ++++++");
            }
          }
          
          
          function MoveForwardToPathnode(String pathnode, String action)
          {
          `log("+++++ Move Forward Pathnode ++++++");
          }
          
          
          function PauseAction()
          {
          `log("+++++ Pause ++++++");
          }
          
          
          function ResumeAction()
          {
          `log("+++++ Resume ++++++");
          }
          
          
          state WalkToLocationState
          {
          begin:
              WaitForLanding();
              Pawn.SetMovementPhysics();
              MoveTo (position);
          }

          Comment


          • #6
            Maybe try:

            simulated function PostBeginPlay()
            {
            super.PostBeginPlay();

            SetPhysics(PHYS_Falling);//or PHYS_Walking, not sure but think Falling
            }

            Comment


            • #7
              [SOLVED]

              Originally posted by uberman View Post
              Maybe try:

              simulated function PostBeginPlay()
              {
              super.PostBeginPlay();

              SetPhysics(PHYS_Falling);//or PHYS_Walking, not sure but think Falling
              }

              Wow, it works now.

              Thank you thank you to everybody who participated.

              Comment

              Working...
              X