May 23, 2012, 01:44:05 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Please report any bugs or issues that you might be encountering with the Beta in the Support System so that we can better keep track of any oustanding issues that may come up.

GameCore Support System
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: 4 Wheeling....  (Read 755 times)
Steely Dane
Sr. Member
****
Posts: 287


View Profile
« on: June 25, 2009, 09:55:38 PM »

I've been looking through the script (vehicle_4wheel.gsl), and I'm not exactly sure what I'm looking for as far as what makes the rear wheels "drive" the vehicle forward, so to speak.
I want to get a 4 wheel drive thing going.
I'm assuming the wheels aren't actually pushing the vehicle forward, it just acts in this manner as long as the rear wheels are touching ground. So, I'm also assuming it's as simple as applying the same parameters to the front wheels so the vehicle continues to move forward as long as there are any wheels touching the ground...

Would this be the script I'm looking for, and if so, anybody have a clue how to modify it?:

   // engine forces

   // forward momentum from back wheels
   if (TANK_STEERING)
   {
      if (frontLeftOnGround)
         collideBase.AddForce( mtx.ZAxis * leftSideForce, object.GetCurMatrix().Project( frontLeftWheelPosition));
      if (frontRightOnGround)
         collideBase.AddForce( mtx.ZAxis * rightSideForce, object.GetCurMatrix().Project( frontRightWheelPosition));
      if (backLeftOnGround)
         collideBase.AddForce( mtx.ZAxis * leftSideForce, object.GetCurMatrix().Project( backLeftWheelPosition));
      if (backRightOnGround)
         collideBase.AddForce( mtx.ZAxis * rightSideForce, object.GetCurMatrix().Project( backRightWheelPosition));
      if (middleWheels)
      {
         if (middleLeftOnGround)
            collideBase.AddForce( mtx.ZAxis * leftSideForce, object.GetCurMatrix().Project( middleLeftWheelPosition));
         if (middleRightOnGround)
            collideBase.AddForce( mtx.ZAxis * rightSideForce, object.GetCurMatrix().Project( middleRightWheelPosition));
      }
   }
   else
   {
      if (backLeftOnGround)
         collideBase.AddForce( mtx.ZAxis * leftSideForce, object.GetCurMatrix().Project( backLeftWheelPosition));
      if (backRightOnGround)
         collideBase.AddForce( mtx.ZAxis * rightSideForce, object.GetCurMatrix().Project( backRightWheelPosition));
   }
}

I realize that this particular script applies for the tank steering, but it's the only reference I could find of engine force applied to the wheels.......




« Last Edit: June 25, 2009, 09:57:52 PM by Steely Dane » Logged
Steely Dane
Sr. Member
****
Posts: 287


View Profile
« Reply #1 on: June 25, 2009, 10:00:19 PM »

....or would it be just easier to put 4 "rear wheels" on the vehicle, if that's even possible?
I plan to use the 4 wheel steering option as well, since it's for a monster type truck.......
Logged
Steely Dane
Sr. Member
****
Posts: 287


View Profile
« Reply #2 on: June 26, 2009, 03:35:19 PM »

Wow, 17 reads and no reply's? 
Did I stump everybody, or is my question too ridiculous to contemplate (wouldn't be the first time), lol?
Logged
BigDaz
Sr. Member
****
Posts: 345


HardCore


View Profile
« Reply #3 on: June 26, 2009, 07:46:45 PM »

The part after 'else' is what powers the rear wheels. You just need to copy and paste the front wheels in too I think


else
   {
      if (frontLeftOnGround)
         collideBase.AddForce( mtx.ZAxis * leftSideForce, object.GetCurMatrix().Project( frontLeftWheelPosition));
      if (frontRightOnGround)
         collideBase.AddForce( mtx.ZAxis * rightSideForce, object.GetCurMatrix().Project( frontRightWheelPosition));
   
      if (backLeftOnGround)
         collideBase.AddForce( mtx.ZAxis * leftSideForce, object.GetCurMatrix().Project( backLeftWheelPosition));
      if (backRightOnGround)
         collideBase.AddForce( mtx.ZAxis * rightSideForce, object.GetCurMatrix().Project( backRightWheelPosition));
   }

There's also a spin multiplayer which speeds up the rotation of the rear wheels when they're not on the ground which you can change to suit the front too. Haven't got time to check that at the moment.
Logged
Steely Dane
Sr. Member
****
Posts: 287


View Profile
« Reply #4 on: June 26, 2009, 10:39:47 PM »

Thanks, Buddy!
I knew one of you scripting wizzes could help me out!
I'll let you know how it works out....
Logged
Ron
Sr. Member
****
Posts: 326


View Profile
« Reply #5 on: June 27, 2009, 01:14:05 PM »

I know the scripts can look daunting at first, but if you go through them line-by-line, everything starts to make sense and fall into place.

When I try to learn exactly what a script or function does, I comment out line-by-line until the script is down to the bare essentials (but still works  Smiley) to figure out whats going on. In no time at all, all the sudden it will 'click' with you and thats when the real fun begins to add your own touch or behavior.
Logged
Steely Dane
Sr. Member
****
Posts: 287


View Profile
« Reply #6 on: June 28, 2009, 04:35:39 PM »

True dat.
I'm kind of pleased with myself just for figuring out that particular piece of script was even close to what I was looking for...
I don't usually get dauntified (is that even a word?...if not it, should be...) by new things much anymore.
I managed to teach myself 3d modelling so that kind of broke me of the "it's so difficult, I'll never figure this out" syndrome.

This problem for example...after spending 20 minutes going back and forth over the script, it seemed that those lines were the most logical suspects, but I had that nagging voice in the back of my head saying "There's no way it's that simple...".
I'm slowly coming to realize that when I hear that voice, I'm probably on the right track.
Always good to get an experienced opinion though.
Learning the hard way may be glamorous and let's you be a little smug about the experience, but it takes a hell of a lot longer to get anything accomplished...

I just wished more people on here had modelling problems I could help them with, since that's my forte  Wink.

Logged
Pages: [1]
  Print  
 
Jump to:  

 
Powered by MySQL Powered by PHP bluBlur Skin © 2006, hbSkins
Powered by SMF 1.1.14 | SMF © 2006-2011, Simple Machines LLC
Valid XHTML 1.0! Valid CSS!