Announcement

Collapse
No announcement yet.

Rotating minigunbarrel

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

    Rotating minigunbarrel

    Hi there, I'm making a helicopter model which needs a gattling gun on each side with obviously, rotating barrels

    making the rotorblades rotate wasn't too hard, but I can't get the barrels to rotate

    so if anyone could help me with that? btw I'm using the scripts from the Goliath Minigun and the Pawn script from the Hellbender Reargun, bones are set up correctly just have no idea how to make the **** thing rotate

    Thanks.

    #2
    Your probly going to have to animate them in your modeling program. I dont think you can rotate them via code. If someone knows how to do it with code, I would be interested to know.

    You have to save the spinning animation and then in the fire function you have to go PlayAnim(....) (sorry havnt worked with custom animations yet, though I will soon enough.)

    Comment


      #3
      well if rotor blades can be rotated I don't see why a minigun can't be rotated in code...

      Comment


        #4
        I'm not at home this weekend so I can't give you exact code right now, I have twin, 5-barrel gatling guns rotating fine (including a brief spin down period with spin down sounds). Look at the code for the rocket laucher for rotating/updating the barrels every tick for each time a bullet is emitted. If you want, i can e-mail you the code on Tuesday for a direct drop in. cosper@tcnj.edu
        Or you can do it yourself, but I started with the rocket launcher code.

        Hope this helps

        Cosper

        Comment


          #5
          Surely the same way you did the rotors? I assume you used SetBoneRotation? The UT2004 minigun uses the same method (in 1st person).

          Comment


            #6
            well actually MrEvil, I used the method you explained for the rotor of the Apache

            I fully understand what's happening there but I can't see where to put the code for my weapon

            and Cosper11, I'd appreciate that, even though maybe I might just figure this out myself it's always usefull to look at someone elses solution, I'll send you an e-mail

            Comment


              #7
              well, my apologies for this unsubtle kick but I really hope to get my question answered

              tnx

              Comment


                #8
                Um put it in the fire funcion. also i was about to make somthing for wicked but didnt work. but i am going to do it for his drop ship but its alot ezer with just making an animation and calling it with code.

                BTW i made new rotor code thats alot better. it baces the speed on the force that is applyed to the helicopter so it looks alot more realilistic. alto when you hit stallz it screws you up becauz all stallz dose is set your rise (where the rotor speed comes from) to 0.

                EDIT. after we releas the new UTvehivleBeta ill make a new ONSweapon for you.

                Comment


                  #9
                  I've tried putting it in the fire() function before, the problem is I couldn't get any DeltaTime out of that function to set the rotating speed

                  so.........wha'ts your solution for that problem?

                  Comment


                    #10
                    Jzz... you got mail

                    Cosper

                    Comment


                      #11
                      Take a look at the minigun code, its really complicated, but it makes it wasy to change rate of fire and stuff but still look good. My advice: copy the code, change it, attach it to ur own model, and shoot things.

                      Comment


                        #12
                        well, what can I say, it works

                        however, does anyone know of a smooth way to make it stop when you stop firing?

                        or does a special boolean for that exist?

                        Comment


                          #13
                          found it already, let me share it with you :P

                          Code:
                          simulated function CeaseFire(Controller C)
                          {
                                    Super.CeaseFire(C);
                                    bRotateBarrel=false;
                          }
                          
                          simulated function FlashMuzzleFlash()
                          {
                          	Super.FlashMuzzleFlash();
                          
                          	if (Role < ROLE_Authority)
                          		DualFireOffset *= -1;
                          
                          	UpdateTracer();
                          		
                          	RotateBarrel();
                          }
                          
                          simulated function RotateBarrel()
                          {
                                    bRotateBarrel = true;
                          }
                          
                          simulated function Tick(float dt)
                          {
                                    Super.Tick(dt);
                                    if(bRotateBarrel)
                                    UpdateBarrels(dt);
                          }
                          
                          simulated function UpdateBarrels(float dt)
                          {
                                    local rotator R;
                          
                                    BarrelRotation += dt * 15*8192;
                                    BarrelRotation = BarrelRotation % 65536;
                                    R.Roll = BarrelRotation;
                                    SetBoneRotation('Rotate',R,0,1);
                          }

                          Comment

                          Working...
                          X