Announcement

Collapse
No announcement yet.

Rotating joints

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

    Rotating joints

    i am making an ah/64-d longbow apache and i need to beable to rotate the joint (rotors)

    so

    if (bDriving)
    {
    // what do i put here to rotate the joints
    }
    else
    {
    //what do i put here to make them stop???
    }

    thanks

    #2
    You want SetBoneRotation.

    Comment


      #3
      could you give me an example. or what file ut2004 uses to make the wheels turn on a vehicle?

      Comment


        #4
        Here's an example from the Rocket Launcher code, where it's used to rotate the barrels as rockets are loaded:
        Code:
        simulated function UpdateBarrel(float dt)
        {
            local Rotator R;
        
            BarrelRotation += dt * 65535.0 * BARREL_ROTATION_RATE / NUM_BARRELS;
            if (BarrelRotation > FinalRotation)
            {
                BarrelRotation = FinalRotation;
                bRotateBarrel = false;
            }
        
            R.Roll = BarrelRotation;
            SetBoneRotation('Bone_Barrel', R, 0, 1);
        }
        It is called every tick that the barrels are rotating. Search the source code for more examples, and look on the Wiki.

        Comment


          #5
          thanks for the info now i know what to look for.

          Comment


            #6
            mmm i did a search with Wotgreal and that wasnever used in anything super of the vehicles...

            so is there any thing else?

            Comment


              #7
              No, it's not used for any vehicles, but the principle is the same wherever it is used: Increment the rotation a bit every tick.

              Comment


                #8
                so inside the tick function i would do that?

                also can i just incurment the rad by 1 or somthing then when it gets to 360 (65535) set it back to 0

                like
                int i;
                i=0
                function tick ()
                {

                if (i >= 65535)
                i=0

                i+=10
                SetBoneRotation('Bone_Barrel', i, 0, 1);
                }

                i see that it has to be a rotaror but can you look at it and fix it plzz.

                Comment


                  #9
                  ok thats messed up so here is this and it compiled right

                  simulated function Tick(float DeltaTime)
                  {
                  SpinRotor();
                  }

                  simulated function spinRotor ()
                  {
                  local Rotator R;
                  local Rotator i;
                  i.roll=65535;

                  if (R.roll >= i.roll)
                  R.roll=0;

                  R.roll+=20;
                  SetBoneRotation('Rotor', R, 0, 1);
                  }

                  Comment


                    #10
                    That's the idea, but ticks don't occur at regular intervals so adding a constant amount will result in unstable rotational speed. You need to make use of the DeltaTime parameter (how many seconds since last tick), e.g.
                    Code:
                    var rotator R;
                    
                    simulated function Tick(float DeltaTime)
                    {
                    	SpinRotor(DeltaTime);
                    }
                    
                    simulated function SpinRotor(float DeltaTime)
                    {
                    	R.Roll += SpinSpeed * DeltaTime;
                    	SetBoneRotation('Bone_Barrel', R, 0, 1);
                    }

                    Comment


                      #11
                      Ohh, I wan't an apache!

                      BTW - Hows the WoE making going?

                      Comment


                        #12
                        Originally posted by Format Life:
                        ...BTW - Hows the WoE making going?
                        It's going alright. I didn't manage to recruit quite as many team members as I would have liked, but it will still get done, just a little slower.

                        Comment


                          #13
                          WOOT it works well sept i dont need roll but it still works

                          var rotator R;
                          var Rotator i;
                          var () int SpinSpeed;

                          function PostNetBeginPlay()
                          {
                          i.Roll=65535;
                          SpinSpeed=200;
                          R.Roll=0;

                          super.PostNetBeginPlay();
                          }

                          function Tick(float DeltaTime)
                          {
                          spinRotor(DeltaTime);
                          }

                          function spinRotor (float DeltaTime)
                          {
                          if (R.Roll >= i.Roll)
                          R.Roll = 0;

                          R.Roll += SpinSpeed * DeltaTime;
                          SetBoneRotation('Rotor', R, 0, 1);
                          }

                          thanks.

                          Comment


                            #14
                            oh and BTW format life;

                            Wicked Pingune and I are making a military Mod so you can have a hole tone of em.

                            Comment

                            Working...
                            X