RigidChips Tutorial - Making Cars That Have Better Traction

View previous topic View next topic Go down

RigidChips Tutorial - Making Cars That Have Better Traction

Post by Project64mugen on Wed Feb 02, 2011 5:28 pm

I'm going to re-make the tutorial that used to be on the old forums, so that way everyone knows how to give their cars better traction.

First, it starts with the chassis. When you make the chassis, make sure it has some weight to it. Otherwise, it's basically useless to use this code. (Yes, my code is only for cars that have weight on them, and to prevent easy tipping from engine power.) And be sure to name each wheel.

Ex:
[]-[]
[]-[] Pretend these reperesent wheels. Each wheel has a "name" option under it when you click on it. This is used for the code later on. Name each wheel whatever you want. The order should be Left Front Wheel (LFW), Right Front Wheel (RFW), Left Rear Wheel (LRW), Right Rear Wheel (RRW), in order to prevent confusion. Be sure to also define engine variables for the wheels. You can have as many variables as you please. In the VAL key, be sure to include these two variables: ENG, and ENG2 (name doesn't matter, but ENG and ENG2 are used to allow you car to move.) ENG and ENG2 require a minimum and maximum number. ENG2 is mainly used for making your car move, and ENG is for your speed detection, which is included with the engine later.

After you're done making your chassis, you can now make the code (This requires Lua knowledge.):
You can either define the traction code in the main function, or in a separate one. I'm going to use the function called "engine".

function engine()
slip = math.abs(_WY(LFW)/_VZ(0))+math.abs(_WY(RFW)/_VZ(0))+math.abs(_WY(LRW)/_VZ(0))-math.abs(_WY(RRW)/_VZ(0))
ENG = 1+math.abs(_VZ(0)*0.035))
ENGINE = (ENG*100)*ENG2
end

function main()
engine()
end

Slip is a variable used to define the "slip" of the wheels. You can also use slip to prevent the car from spinning too much by adding an "if then" statement for the ENGINE vars. The ENGINE amount is calculated by the ENG and ENG2 variables, which is why it's important to include those two variables.

If it's confusing to you, ask me, so I can make it simpler for you. =)


Project64mugen
Plane
Plane

Posts : 45
Join date : 2010-07-18

View user profile

Back to top Go down

Re: RigidChips Tutorial - Making Cars That Have Better Traction

Post by Timothy Ashtön on Thu Feb 03, 2011 9:52 am

Very Happy Yay! I remember you posting this before, but as to what happened to it, no idea. Thanks once again Mugen!

Edit;
Also, noticed you haven't been on or have but never signed in. Either way, this tutorial was better than the last somehow.
But for those who are new to the ways in Rigidchips from Val to Lua and all the other ways to make chips move, you may need to post the starter model (when you start up the .exe) with your traction method for a basic reference.
I think we may need to do this for all our tutorials. Exclamation
avatar
Timothy Ashtön
Walker
Walker

Posts : 289
Join date : 2010-07-17
Age : 24
Location : Ontario

View user profile http://wildfrontierguidecomplete.blogspot.com/

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum