Announcement

Collapse
No announcement yet.

Creating a Crane apparatus - Pawn help [04]

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

    Creating a Crane apparatus - Pawn help [04]

    I have set up a fairly simple crane apparatus that involves two Pawns, the CraneParent and the CraneChild. The constraints and directions of the crane components are hard-coded as it is for a specific map.

    The way it works is that the CraneParent moves along a giant track. It's movement provides the movement of the crane system in the Y direction. The CraneChild (a little section attached to the Parent, has the claw of the crane) moves along the CraneParent, providing the X direction of the crane's movement. The parent randomly chooses a Y location within it's range. Once this is done, it triggers the Child, which randomly chooses an X location. The velocity of the Parent is constant Y = 300 when moving, so the velocity of the Child is calculated fresh for each 'target' location so as to have them both arrive at the destination at the same time. The Child's Y location is constantly forced to that of the Parent's to give the illusion of one unit.

    Originally they were just actors, and all was dandy. I decided that they should be destructable and player-controllable, so I made them pawns. After much tooling around, I managed to get the CraneParent to move exactly how it is supposed to, and not be affected by gravity or other random stupidities. The Child decided that it would be different. When the game starts, it moves how it is supposed to but after a while it will either stop moving then all of a sudden zap back to the Parent, move really slow then really fast, deviate off of the track completely and just sit there or some other random problem.

    Is there any way to add movement constraints to a pawn? i.e. Set a pawn a global coordinate limit past which it cannot go?

    The code and a test map for them are here:
    http://www.marzerium.com/files/HighRise-RiggingTest.rar (~190kb)

    Also, I have begun messing around with the code to control the crane, but if you use the provided trigger, you will notice the results at the moment are complete ****. I'll get to that one later

    Any suggestions are much appreciated!

    #2
    Can't open your map, missing PC_Urban StaticMesh file.


    Also, try using bHardAttach=True and attach your child pawn to HighRiseCraneParent class if you can. This way the child pawn will always move with it's owner the HighRiseCraneParent class. This should also prevent them from moving away from their owner.

    I'm not sure, until I see what it is doing.

    Comment


      #3
      In the map the Child is HardAttached to the Parent. Also, in the code I attach it using SetBase() AND Attach(), and still no dice.

      I'll re-upload the map without the package dependancy. Sorry about that!

      Comment


        #4
        I re-uploaded the file. Same link (in first post).

        I have now made the parent crane piece catch of fire when it is badly damaged and have improved the possession code. I still need to make a custom player controller.

        Any help on getting the child piece to behave properly would be great!

        Comment


          #5
          I would reccomend taking alook at how turrets work for vehciles, they use the attach to bone funciton which will work if you convert the whole assembly to animations (wchich can be rigidized)

          Comment


            #6
            Nvm... fixed it

            Ended up just having the child piece being a normal attached actor - works a treat (apparently pawns don't like being attached to other pawns or something)

            Comment


              #7
              You could write your own damage routine for the claw if you still need it to take damage

              Pulled form my own exploding health
              Code:
              //Items don't have a take Damage function.  Coded my own.
              function TakeDamage(int Damage, Pawn instigatedBy, Vector HitLocation, Vector momentum, class<DamageType> damageType)
              {
              	 HealingAmount = HealingAmount - Damage;
              
                   if (HealingAmount <= 0)
                        {
                             HealingAmount = 0;
                             ExplodeHealth( HitLocation );
                             SetRespawn();
                        }
              }
              I'm sure that is pretty easy to follow if not, ask

              Comment


                #8
                Thanks (no, really, thanks - I was of the misconception that non-pawns could not take damage :bulb: ), but I've decided that the claw won't be destroyable (not until the crane itself dies). That makes things easier at Reset() as this is for an assault map.

                Comment


                  #9
                  That's cool

                  As for only pawns taking damage, that's something that I could just not deal with when it came to my exploding health, then I realized it's only a funciton and worked form there

                  Comment

                  Working...
                  X