Announcement

Collapse
No announcement yet.

How can I change a player's scale in game?

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

    How can I change a player's scale in game?

    I want to change a player scale in-game (shrink or enlarge).
    I made a function where I change the following variables: drawscale, collisionradius/height, eyeEight, jumpz.
    the problem is that ,although it works perfectly for player pawns there's still a problem with bots. When enlarging, the bots' meshes stay halfway in the ground and when shrinking they are hovering over the ground : it seems that the collision dimensions aren't modified, but I don't know why it works on players and not on bots.
    It might be related to a controller state but I could find nothing.

    Any idea?

    #2
    SetDrawScale(float NewScale)
    SetDrawScale3D(vector NewScale3D)
    SetCollisionSize( float NewRadius, float NewHeight )

    These are the functions which should work fine during gameplay.

    Keep in mind that collision for pawns is not the same scale as the 3D model, since collsion mainly only works on Z (height) with X & Y (radius) being the same.

    Comment


      #3
      I know that collsion has to be tweaked to fit perfectly the 3d model but this is not the real problem
      I change drawscale by a factor f ,then I change collision radius and height by the same factor F. I know it won't be perfect but it's ok.
      The problem is that for bots its not working.
      I tried changing the factor F with a very high number like 1000 (so that the final collision height would be sthg like 44000 !) but on screen the models remain with the default collision values (height of 44 units).
      And its only doing that for the bots, players' pawns are scaled fine and have both feet on ground :weird:

      Comment


        #4
        Check it

        http://udn.epicgames.com/Two/PawnTricksAndTips

        also note: you will have collision problems unless you set bCanCrouch=false in your pawn defaults. Uncrouching seems to cause the collision cylinder to be pushed through the ground, then you fall through.

        Comment


          #5
          http://udn.epicgames.com/Two/ActorVa...ctor_Variables This may also help.

          Comment


            #6
            I was just wondering if CyberTao ever figured out this problem with the bots. I'm looking into the same thing and have come to a dead end. Any luck finding a solution?

            Comment


              #7
              See the link in my previous post. Thats how I did it for Robostorm . The collision will still mess up when you crouch, thats why crouching was disabled for Robostorm.

              When I implemented it, I did not notice any differences in the way it worked for players and the way it worked for bots. Perhaps by the time you see the bots, they have already crouched, uncrouched a few times. This causes major wierdness.

              Comment


                #8
                I think you can get it to work with crouching too.

                Here's a way that we dealt with this when we were trying to increase the size of a Pawn. I say we, but I didnt actually write this code. Anyways.

                So in the controller class, in tick:
                function Tick( float DeltaTime ) {
                drawToScale();

                And then the drawToScale() function:

                Code:
                function DrawToScale()
                {
                  local float myNum;
                
                   myNum = 4.0;
                
                   Pawn.SetDrawScale(myNum);
                   Pawn.Weapon.SetDrawScale(myNum);
                   if (self.bDuck==0)
                      Pawn.SetCollisionSize(Pawn.Default.CollisionRadius * myNum, Pawn.Default.CollisionHeight * myNum);
                   else
                      Pawn.SetCollisionSize(Pawn.Default.CrouchRadius * myNum, Pawn.Default.CrouchHeight * myNum);
                }

                Comment

                Working...
                X