Announcement

Collapse
No announcement yet.

Uprighting a vehicle

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

    Uprighting a vehicle

    I have a two wheeled vehicle. When making turns, it leans into the curve (nothing had to be done to achive this really, it worked automaticaly). However after having leaned into a sharp turn, when going upright again, it oscillates a lot, to the extent that it looks ridiculous. I'd like it to just smoothly go back upright without any oscillations.

    There are severeal variables that are inherited from the SVehicle class, that seem to be related (judging from the names). However, I have a hard time actually understanding what they do and how I should think when tweaking. For instance, we have bStayUpright; StayUprightRollResistAngle;StayUprightPitchResistA ngle; StayUprightStiffness; StayUprightDamping;

    And what are these constraints, and how do I use them?

    RB_StayUprightSetup StayUprightConstraintSetup;
    RB_ConstraintInstance StayUprightConstraintInstance;

    I'm blindly trying different settings, and most of the times nothing happens at all when chaning something (even by radical amounts), which makes me think I'm missing something (constrains, some important bools?), making the changes ineffective.

    I'd be very grateful if someone could explain how this works. The documentation didn't help me that much unfortunately (http://wiki.beyondunreal.com/UE3:SVe...ties_%28UDK%29).

    #2
    ive got the same problem with my bike.origionally it leant the wrong way when turning,but leant over and righted itself smoothly.changing the comoffset sorted the lean direction but produced the same wobble your having.im still doing much as you are with the settings you mention.i will post any advances here.http://forums.epicgames.com/threads/...Download/page6

    Comment


      #3
      do you have 4 wheels?
      have 2 'invisible' wheels out to the side of the bike like stabilisers.
      you can then mess around with suspension stiffness and travel to suit the weight of the bike.
      that along with upright force should sort it out for you.

      Comment


        #4
        Thanks. I'm experimenting with invisible support wheels now. Btw, what does WheelSuspensionBias mean?

        Comment


          #5
          i dont think support wheels will do the job.its not like the bikes leaning so far it will fall over,but that when it reaches its max lean angle the uprighting is pushing it all the way to the opposite side.i still think the answer lies there somewhere.

          Comment


            #6
            Yeah, I think you're right Gaz. I've been playing around with support wheels today. While I "kind of" got it working, things start to get very unreliable. If the support wheels suddenly make contact with the ground in high speeds, the vehicle can flip over and stuff like that. It seems too hard to manage.

            So I'll go back to trying to get uprighting forces and that stuff to work right. Doesn't seem easy though.

            If anyone else is struggling with this and is frustrated by the bad documentation, this might be of some use:

            //Upright variables are only used to flip vehicle right if it went upside down. Disregard them.
            UprightLiftStrength=0
            UprightTime=0
            UprightTorqueStrength=0

            So I guess these are the important ones:
            StayUprightStiffness=XXXX
            stayUprightDamping=YYYY

            (I currently, have 100 and 3)

            I think they only have impact if:
            bStayUpright=true

            And if I set that to TRUE, the vehicle seem to be absolutely forced upright, so steering is screwed.

            Please post any progress you guys do, and I will do the same.

            UPDATE 1:

            Even if I set it to:
            StayUprightStiffness=0
            stayUprightDamping=0
            bStayUpright=true

            The vehicle is 100% upright (with the effect that it can't really steer much and behaves weird.)

            UPDATE 2:

            In SVehicle.uc, it says:
            /** Use the stay-upright world constraint */
            var(UprightConstraint) bool bStayUpright;

            So okay, it uses this constraint. I don't really understand how it works, but its default properties are defined in SVehicle as:

            Code:
            	Begin Object Class=RB_StayUprightSetup Name=MyLeanUprightSetup
            		LinearXSetup=(bLimited = 0)
            		LinearYSetup=(bLimited = 0)
            		LinearZSetup=(bLimited = 0)
            	End Object
            	StayUprightConstraintSetup=MyLeanUprightSetup
            
            	Begin Object Class=RB_ConstraintInstance Name=MyLeanUprightConstraintInstance
            		bSwingPositionDrive=true
            		AngularDriveSpring=10
            		AngularDriveDamping=10
            	End Object
            So I have added this to my Vehicle class in default properties:

            Code:
            	// Stay-upright constraint
            	Begin Object Name=MyStayUprightSetup
            	End Object
            	StayUprightConstraintSetup=MyStayUprightSetup
            
            	Begin Object Name=MyStayUprightConstraintInstance
            	End Object
            	StayUprightConstraintInstance=MyStayUprightConstraintInstance
            No differance yet (no surprise really of course). Will try to tweak these constraint components. If anyone knows anything about them and how they are used, please let me know.

            UPDATE 3:

            It turned out that we had an extra bone (like an axle) between the root bone on the bike and the support wheels. That was the reason why everything got screwed up when using the support wheels. We have now made a new rig, with all wheel bones directly connected to the root (as it always should be). Will give the support wheel idea one more shot.

            Comment


              #7
              UPDATE 4:

              For now, I've actually settled with the support wheel solution. When we finally got the rig problems worked out, it worked pretty good. On each side of the back tire, I added an extra wheel, at the same height (in the picture they are visible, but this is the debug model of course). They are 35 cm from the main wheel. All wheels are powered (yes, even the front wheel).



              Code:
              WheelSuspensionStiffness=5.0
              WheelSuspensionDamping=3
              bStayUpright=false
              COMOffset=(x=0,y=0.0,z=-50) //The Center of mass is way below the bike
              The main wheel has SuspensionTravel=0 (so it's totally solid, doesn't use suspension at all)
              The support wheels have SuspensionTravel=45

              Because of the support wheels and their very low stiffness, they significantly reduce the amount of oscillations when the cyclist returns from a heavy lean (there are still some, but you only notice it if you now it's there). All this could of course be tweaked to perfection. I'd like to try and see if results can be improved even more by adjusting the Z of the support wheels, the suspension settings, powered/unpowered support and frontwheels and so on. I won't cover it here though, since it's just a matter of tweaking. I hope all this can be of help to somebody.

              Thanks for everyones input.

              Comment


                #8
                and thanks for posting your results.i will try the support wheel option.the moral of the story is-listen to tegleg,he knows his stuff.

                Comment


                  #9
                  You guys ever figure out a good solution? I got the same problem. Although im trying invisible support wheels on the front and rear.

                  Comment

                  Working...
                  X