Announcement

Collapse
No announcement yet.

Scorpion Vehicle: Getting it to move in the direction that you're looking

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

    Scorpion Vehicle: Getting it to move in the direction that you're looking

    The viper makes you move in the direction that you are looking. So my question is, is it possible to make the scorpion do the same thing and if so how?

    I've been looking through the variables and I haven't seen anything yet. I'm hoping that I'm just missing something and that it's relatively easy to do...

    #2
    Would make firing it somewhat more difficult.

    The console versions have an option to change the steering modes, but oddly the PC version lacks one.

    Comment


      #3
      Originally posted by Shadow Dancer View Post
      Would make firing it somewhat more difficult.

      The console versions have an option to change the steering modes, but oddly the PC version lacks one.
      Thanks for the response. So I guess my next question is how does the Viper move in the direction the user is looking?

      Is it inherit to hover / flying vehicles?

      Comment


        #4
        I'd also like to hear how this works... in my case for tanks. I looked around a bit but haven't yet found anything.

        What are the names of the steering modes on the console? I could search the code for those.

        Comment


          #5
          Direct, Relative and Mixed.

          Direct has all non-fixed-turret vehicles drive like the Scorp does now, so you can drive and fire in different directions.

          Relative makes all vehicles drive Halo style, where you look/aim to turn.

          There doesn't seem to be much difference between Mixed and Direct.

          Comment


            #6
            What about:
            bLookSteerOnNormalControls=false
            bLookSteerOnSimpleControls=true
            bFollowLookDir=True

            Or have you looked at the Nemesis?
            It changes height, and at the lowest setting you have to looksteer, but not higher.

            Comment


              #7
              You could try tweaking the Steering variable based on the difference between the vehicle's rotation and the controller's rotation.

              Originally posted by Malachor View Post
              Or have you looked at the Nemesis?
              It changes height, and at the lowest setting you have to looksteer, but not higher.
              On console? On PC it certainly does not looksteer in crouched mode, even though that would have been great.

              Comment


                #8
                Doh! I should have checked before posting that.
                I knew it fixed the turret position and assumed that it made it looksteer.

                Comment


                  #9
                  I found a clue in UTVehicle.SetInputs. There's some console specific stuff that converts the direction you're looking at into Left/Right input. I haven't messed with it yet, but I will at some point.

                  Comment


                    #10
                    Did anybody ever figure this out? I'd like to do that for my vehicle too.

                    Comment


                      #11
                      Here you go:

                      Code:
                      simulated event SetInputs(float InForward, float InStrafe, float InUp)
                      {
                          super.SetInputs(InForward, InStrafe, InUp);
                          LookSteer();
                      }
                       
                      private simulated function LookSteer()
                      {
                          local bool bReverseThrottle;
                          local rotator SteerRot, VehicleRot;
                          local vector SteerDir, VehicleDir, AngVel;
                          local float VehicleHeading, SteerHeading, DeltaTargetHeading, Deflection;
                       
                          Steering = FClamp(Steering * ConsoleSteerScale, -1.0, 1.0);
                       
                          // If we desire 'look steering' on this vehicle, do it here.
                          if(IsHumanControlled())
                          {
                              // If there is a deflection, look at the angle that its point in.
                              Deflection = Sqrt(Throttle*Throttle + Steering*Steering);
                       
                              if(bStickDeflectionThrottle)
                              {
                                  // The region we consider 'reverse' is anything below DeflectionReverseThresh, or anything withing the triangle below the center position.
                                  bReverseThrottle = ((Throttle < DeflectionReverseThresh) || (Throttle < 0.0 && Abs(Steering) < -Throttle));
                                  Throttle = Deflection;
                       
                                  if(bReverseThrottle)
                                  {
                                      Throttle *= -1;
                                  }
                              }
                       
                              VehicleRot.Yaw = Rotation.Yaw;
                              VehicleDir = vector(VehicleRot);
                       
                              SteerRot.Yaw = DriverViewYaw;
                              SteerDir = vector(SteerRot);
                       
                              VehicleHeading = GetHeadingAngle(VehicleDir);
                              SteerHeading = GetHeadingAngle(SteerDir);
                              DeltaTargetHeading = FindDeltaAngle(SteerHeading, VehicleHeading);
                       
                              if(DeltaTargetHeading > LookSteerDeadZone)
                              {
                                  Steering = FMin((DeltaTargetHeading - LookSteerDeadZone) * LookSteerSensitivity, 1.0);
                              }
                              else if(DeltaTargetHeading < -LookSteerDeadZone)
                              {
                                  Steering = FMax((DeltaTargetHeading + LookSteerDeadZone) * LookSteerSensitivity, -1.0);
                              }
                              else
                              {
                                  Steering = 0.0;
                              }
                       
                              AngVel = Mesh.BodyInstance.GetUnrealWorldAngularVelocity();
                              Steering = FClamp(Steering + (AngVel.Z * LookSteerDamping), -1.0, 1.0);
                       
                              // Reverse steering when reversing
                              if (Throttle < 0.0 && ForwardVel < 0.0)
                              {
                                  Steering = -1.0 * Steering;
                              }
                          }
                      }

                      Comment


                        #12
                        Thanks Xyx, I have been wanting this feature for months. Are we free to use this script with credit in our readme?

                        Comment


                          #13
                          Thanks man! You Rock!

                          Comment


                            #14
                            Nice job! Much better than the 20 minute attempt I gave UnWheelModeller many months ago

                            Comment


                              #15
                              Credit not needed. It's 99% Epic's code. It's what Epic wrote for console steering, hence the whole "stick deflection" business. It could undoubtedly be optimized for keyboard/mouse control.

                              The whole deal is controlled by a bunch of existing defaultproperties; ConsoleSteerScale, LookSteerDeadZone, LookSteerDamping and LookSteerSensitivity.

                              Comment

                              Working...
                              X