Poll

is this useful

no
2 (11.8%)
yes
2 (11.8%)
MY EYES
2 (11.8%)
thank
1 (5.9%)
mac are u still running on a toaster
2 (11.8%)
8 (47.1%)

Total Members Voted: 11

Author Topic: [reference] vehicle variables help, requested by Filipe  (Read 1382 times)

Code: [Select]
datablock WheeledVehicleTire(HelpTire) //datablock name, always put Tire after the end of the name
{
   shapeFile = "./helptire.dts"; //the tire's shape, "./" refers to the script's origin directory

   staticFriction = 5; //how much friction is produced going forwards or backwards (more = better grip in front/backwards movement)
   kineticFriction = 5; //how much friction is produced going left or right (more = better grip in left/right directions)

   lateralForce = 18000; //how much force is produced going left or right
   lateralDamping = 4000; //how much damping force is produced going left or right (so that it doesnt keep moving to the left or right)
   lateralRelaxation = 0.01; //how responsive the tire produces damping and force (less = better grip)

   longitudinalForce = 14000; //how much force is produced going forwards or backwards
   longitudinalDamping = 2000; //how much damping force is produced going forwards or backwards (so that it doesnt keep moving forwards or backwards)
   logitudinalRelaxation = 1; //how responsive the tire produces damping and force (less = better grip)
};

datablock WheeledVehicleSpring(HelpSpring) //datablock name, always put Spring after the end of the name
{
   length = 0.4; //how tall is the spring
   force = 3500; //how much force does the spring have
   damping = 800; //how much damping does the spring have
   antiSwayForce = 9; //how much antisway force does the spring have (equalizes the spring length if its unequal)
};

datablock WheeledVehicleData(HelpVehicle) //datablock name, always put Vehicle after the end of the name
{
category = "Vehicles"; //always make sure its in Vehicles, otherwise it wont show up in the spawner
shapeFile = "./help.dts"; //the vehicle's shape, "./" refers to the script's origin directory
emap = true; //environmental mapping, set it to false if you dont want it to respond to environmental changes

   numMountPoints = 1; //how many seats are there
   mountThread[0] = "sit"; //seat animation, [0] means seat 1, [1] means seat 2 and so on

maxDamage = 200; //how much damage can it take before exploding
destroyedLevel = 200; //how much damage can it take before being 'destroyed' (does not destroy the vehicle in any way unless specified in a function)

massCenter = "0 0 0"; //the mass center, the offset starts from the origin of the model (X, Y, Z)
massBox = "0 0 0"; //the vehicle's rotational resistance on a specified axis (X, Y, Z)

maxSteeringAngle = 1.1; //the vehicle's maximum steering angle (in radians, 1 radian = 57.3 degrees)
integration = 4; //how many physics checks are done in a millisecond
tireEmitter = VehicleTireEmitter; //vehicle's tire emitters

cameraRoll = false; //makes the camera roll along with the vehicle, if the vehicle does roll that is
cameraMaxDist = 10; //how far is the camera away from the vehicle
cameraOffset = 7; //how high is the camera away from the vehicle
cameraLag = 0; //how much does the camera lag away from the vehicle
cameraDecay = 0; //how quickly does the camera moves back to the vehicle if it stops
cameraTilt = 0.4; //how much is the camera vertically tilted from the vehicle (in degrees)
collisionTol = 0.1; //how close does a object have to be from the vehicle to consider it as a collision
contactTol = 0.1; //how fast the vehicle has to go for objects to detect it as a contact (in torque units)

useEyePoint = false; //does the vehicle redirect the player's 1st person camera to the eye node of the vehicle

defaultTire = HelpTire; //what tire does it use
defaultSpring = HelpSpring; //what spring does it use

numWheels = 4; //how many wheel(s) does it have

mass = 300; //how 'heavy' is the vehicle (affects engineTorque, engineBrake, brakeTorque, spring, tire, rollforce, yawforce, pitchforce and maxwheelspeed)
density = 5.0; //how dense is the vehicle (affects the ability to 'float' on water)
drag = 1.5; //how much aerodynamic drag does the vehicle have
bodyFriction = 0.3; //how much friction is produced when the vehicle scrapes with an object
bodyRestitution = 0; //how bouncy the vehicle is when it hits an object
minImpactSpeed = 10; //the collision speed for the onImpact function to be activated
softImpactSpeed = 10; //how fast does it have to go to play the softImpact sound
hardImpactSpeed = 15; //how fast does it have to go to play the hardImpact sound

engineTorque = 8000; //how much torque does the vehicle produce
engineBrake = 2000; //how much brake torque does the vehicle produce at 0% throttle
brakeTorque = 50000; //how much brake torque does the vehicle produce when the brakes are used
maxWheelSpeed = 40; //how fast can the vehicle go (in torque units)

rollForce = 900; //how much roll force does the vehicle have
yawForce = 600; //how much yaw force does the vehicle have
pitchForce = 1000; //how much pitch force does the vehicle have
rotationalDrag = 0; //how much rotational drag does the vehicle have

steeringAutoReturn = true; //does the steering return to its 0 degree position
steeringAutoReturnRate = 0.9; //how fast does the steering return to its 0 degree position
steeringAutoReturnMaxSpeed = 10; //how fast is the auto return's max speed (setting it higher will make the steering auto return at that speed quickier)
steeringUseStrafeSteering = true; //does it use strafe steering
steeringStrafeSteeringRate = 0.1; //how fast does the strafe steering turn

maxEnergy = 0; //maximum energy it can store
jetForce = 0; //how much force is applied when its 'jetting'
minJetEnergy = 0; //minimum energy to allow 'jetting'
jetEnergyDrain = 0; //how much energy is used when its 'jetting'

splash = vehicleSplashEmitter; //the vehicle's splash emitters
splashVelocity = 4; //how fast is the splash emitter's speed
splashAngle = 67; //the angle of the splash emitter
splashFreqMod = 300; //how frequent is the splash emitter
splashVelEpsilon = 0.6; //minimum speed to start splashing (in torque units)
bubbleEmitTime = 1.4; //how long does the splash emitter bubble stays for (in seconds)
splashEmitter[0] = vehicleFoamDropletsEmitter; //splash emitter
splashEmitter[1] = vehicleFoamEmitter; //splash emitter
splashEmitter[2] = vehicleBubbleEmitter; /splash emitter
mediumSplashSoundVelocity = 10; //how fast does it have to go to play the mediumsplash sound (in torque units)
hardSplashSoundVelocity = 20; //how fast does it have to go to play the hardsplash sound (in torque units)
exitSplashSoundVelocity = 5; //how fast does it have to go to play the exitsplash sound (in torque units)
mediumSplashSound = ""; //the sound for the mediumsplash
hardSplashSound = ""; //the sound for the hardsplash
exitSplashSound = ""; //the sound for the exitsplash
jetSound = ""; //the sound for the jetting, its the engine's go sound for some reason (if the vehicle stops, this sound will still play in its 'idle' state)
engineSound = ""; //the idle sound of the engine
squealSound = ""; //the wheel(s) squeal sound, when the tires slide that is
softImpactSound = slowImpactSound; //the softimpact sound
hardImpactSound = fastImpactSound; //the hardimpact sound
wheelImpactSound = ""; //the wheel(s) impact sound, not too sure if there is anything that makes it play when hit at a speed defined

uiName = "Help"; //the name of the vehicle that shows up in the spawner
rideable = true; //is it rideable
   lookUpLimit = 0.5; //how far can you look up (only affects playertype animations, doesn't affect your actual viewing capabilities)
   lookDownLimit = 0.5; //how far can you look down (only affects playertype animations, doesn't affect your actual viewing capabilities)

paintable = true; //is it paintable

   damageEmitter[0] = VehicleBurnEmitter; //the emitter for the damage ([0] > [1] and so on if more damage emitters are needed)
damageEmitterOffset[0] = "0 0 0"; //the offset of the emitter (X, Y, Z)
damageLevelTolerance[0] = 1; //at what damage level should this emitter show up (0-100%)

   damageEmitter[1] = VehicleBurnEmitter; //the emitter for the damage
damageEmitterOffset[1] = "0 0 0"; //the offset of the emitter (X, Y, Z)
damageLevelTolerance[1] = 1; //at what damage level should this emitter show up (0-100%)

   numDmgEmitterAreas = 1; //how many damage emitters are there

   initialExplosionProjectile = HelpExplosionProjectile; //the projectile used when the vehicle's maxdamage reaches its value
   initialExplosionOffset = 0; //the offset for the projectile's position (on the Z axis only)

   burnTime = 4000; //how long does it 'burn' before spawning the final explosion projectile and deleting itself (in milliseconds)

   finalExplosionProjectile = HelpFinalExplosionProjectile; //the projectile used when the vehicle's maxdamage reaches its value
   finalExplosionOffset = 0; //the offset for the projectile's position (on the Z axis only)

   minRunOverSpeed = 2; //how fast does it need to go to damage a playertype (in torque units)
   runOverDamageScale = 12; //how much damage does it deal when ramming a playertype (speed * runoverdamagescale = damage received)
   runOverPushScale = 0; //how much does it push a playertype when hit

   protectPassengersBurn = true; //does the vehicle protect the passengers from burning
   protectPassengersRadius = true; //does the vehicle protect the passengers from radius damage
   protectPassengersDirect = false; //does the vehicle protect the passengers from direct damage
};

datablock DebrisData(HelpTireDebris : jeepTireDebris) //the tire debris, always end the name with TireDebris (not a class itself, but to prevent confusion)
{
   shapeFile = "./helptire.dts"; //the shape of the debris
};

datablock ExplosionData(HelpExplosion : jeepExplosion) //the explosion, always end the name with Explosion
{
   debris = HelpTireDebris; //what debris is it using
};

datablock ProjectileData(HelpExplosionProjectile : jeepExplosionProjectile) //the projectile, always end the name with Projectile
{
   explosion = HelpExplosion; //what explosion is it using
   uiName = "Help Explosion"; //the name of it to spawn it through events
};

datablock DebrisData(HelpDebris : jeepDebris) //the vehicle debris, always end the name with Debris
{
   shapeFile = "./help.dts"; //the shape of the debris
};

datablock ExplosionData(HelpFinalExplosion : jeepFinalExplosion) //the explosion, always end the name with Explosion
{
   debris = HelpDebris; //what debris is it using
};

datablock ProjectileData(HelpFinalExplosionProjectile : jeepFinalExplosionProjectile) //the projectile, always end the name with Projectile
{
   explosion = HelpFinalExplosion; //what explosion is it using
   uiName = "Help Final Explosion"; //the name of it to spawn it through events
};
attachment is available for download, just in case you lazy gongs dont want to ctrl + c the entire thing, or cmd + c

Awesome! This will be super useful to the confused. Thank you so much.



ALREADY WRONG





Oh, the force is force, and the damping is damping. It's all clear now





I understand you're trying to be helpful but this is not informative at all
« Last Edit: June 24, 2017, 12:22:38 PM by Teneksi »

It is possible for tires to lose grip when they're spinning too fast or too slow in relation to the ground under them, or when they're going sideways and trying to give it a big PUSH. Basically, all the circumstances that would cause the sound of tires screeching in real life are something that you can actually have the vehicle react to.

StaticFriction is how much friction the tire has under normal circumstances. Driving slowly, turning gradually, and keeping solid contact with the ground will generally keep your tires under the influence of staticFriction. The higher staticFriction is, and the higher values like lateralForce and longitudinalForce are, the less likely you are to lose it.

When the tires lose contact with the ground, they'll usually start spinning at a different speed. When they meet the ground again, they're not synchronized, and the tires lose grip. They are then using kineticFriction until they stop sliding, and their spin rate meets up with the ground again.

Tires will also lose staticFriction and drop to kineticFriction if the engine is very powerful, and causes the powered wheels to spin. This is especially noticeable on cars which don't have all four wheels powered.

If static is the same as kinetic, you will never feel this difference.

If kinetic is higher than static, when you lose grip, you'll gain more grip. Effectively, both have the higher value.


KineticFriction is certainly not limited to left and right directions, as a kineticFriction of 0 can make it impossible to move forward.


An example of staticFriction and kineticFriction in action is my F1 '67.

F167RearTire has the following values:
   staticFriction = 3.5;
   kineticFriction = 2.9;

The front wheels have 4 and 4. Also, only the rear wheels are powered.
This means that going over bumps while going around a turn or staying on the throttle while turning too sharply can result in a loss of control. Letting go of the throttle and countersteering can allow the rear tires to regain their normal grip.

https://www.youtube.com/watch?v=F4J3dTavlEE&t=1m26s



On the first turn, I'm fine, as my movements are gradual and my wheels stay in contact with the road.



I'm also fine on this sudden evasive move, as I'm at high speed. This one doesn't make as much realistic sense.
The slower you're going, the greater the difference is between your current speed and your maximum speed.
The closer you are to maximum speed, the less the powered wheels can do about it.
In other words, the slower you're going, the more difference there is to make up, and the harder the engine pushes.
So, in a rear wheel drive vehicle with slippery tires, the slower you are, the more the tires will slip if you use the throttle.
At high speed, the throttle won't make a ton of difference in how fast the tires are spinning, and you can stay in control in a short swerve.

However, at high speed, if you try to go into a long or sharp turn, you're asking a lot more of the tires than if you took that turn at low speed, and the lateral force can fail you, causing a loss of grip.




Here, I go over a bump. The rear wheels lose contact. However, I'm using the brake, which keeps the car under control.




At this point, I lose contact again, and I'm using the throttle, but I'm not turning at all. Traveling in a straight line, the wheels are able to synchronize with the ground before the loss of grip makes a difference.




Finally, at this point, my tires lose contact for a moment, I'm using the throttle, AND I'm turning, all at once.




When the right rear wheel got onto the grass, most of the weight was on it, giving it more to do, and causing it to slip.

When the right wheel comes down off the grass, it loses contact with the road, ensuring it still has no grip. The left rear tire cannot compensate.




With both rear tires having reduced grip (based on the kineticFriction value) the car oversteers. In other words, the rear of the car swings around, turning me more than expected.



I attempt to countersteer, but I've already lost it.


That is really helpful Teneksi, you could do more tips about advanced handling

ALREADY WRONG

Oh, the force is force, and the damping is damping. It's all clear now

I understand you're trying to be helpful but this is not informative at all
you finally appeared out of your cave teneksi, i expected that if i had placed uninformative information to drag you out... i didnt bother doing that part because i knew you would show up to give a clear explanation

knowing that you have much more experience than i do in the tire department, its the best that i could do to bring you here

roll, yaw, pitch, and rotational drag are seriously self explanatory if anyone has ever understood how planes made use of them (THIS wasnt meant to be idiot-proof at all)
you can simply set them to 0 because cars in reality do not have such controls, unless they have like flaps or odd ailerons on them lol
large info snip
this couldve been your 1st post in this topic, instead of telling me 'sry its not enough to help'
but a big thanks to you for actually giving out useful info for those that want to try pushing blocklands potential

i would also certainly question why is vehicle realism bought to blockland, and my thoughts about it stated under here
======[generally] realism depicted in blocklands vehicles [generally]=========
- the 'realistic' cars turn like stuff, and they have a extremely wide turning radius?
- the 'realistic' cars lose so much goddamn speed while cornering above 30-40 torque units, are we using paul's 10 year old carrera tires?
- the 'realistic' cars have brakes simulating that of a cut-off brake line, is there a reason why improvements cant be made?
- the 'realistic' cars has acceleration similar to a 1950s beetle, was it even supposed to be on purpose because gears dont work well?
- the 'realistic' cars have springs that are soft as cheese with crap damping, is this intentional to scrape the ground and leave you at a constant risk/danger of suffering a physics breakdown? what are springs used for?
=================================================================
with all due respect though, thank you very much for actually placing effort in that 2nd post to tell what the variables did

I guess the staticFriction and kineticFriction were the first things I noticed, which made me more hostile to the thread as a whole.

Trying to remember the early days of editing phydeoux's planes so they did not slam to a halt when you touch the ground, I feel like I wouldn't have gotten much out of this thread. I suppose it's just a matter of looking up certain terms like damping, but then I could have done that without all the comments.

It's hard to tell, from this perspective, how helpful it would have been. I'm sorry for reacting poorly at first. I'm glad you're trying to be helpful.



As for "dragging me out," you could have sent me a PM any day.



As for realism ......

First of all, I will openly admit that I sometimes become far too focused on a single vehicle, and I forget to have it make sense in comparison to other vehicles, and for it to actually continue being fun within Blockland.

But here is my reasoning for the more frustrating ways in which I make vehicles handle.
I acknowledge that I cannot make a truly realistic car, but edging closer to realism is satisfying to me.
Basically, my philosophy on vehicle handling started as, and basically remained: be the opposite of the Jeep


Driving fast in a vehicle that leaps to top speed in three seconds, turns like it's on a rail, and stops in a blink of an eye IS MIND-NUMBINGLY BORING to me.
There's no risk of crashing except that caused by the springs that send it bouncing around every time you drive over a plate and the massive twitch when you return to the ground while steering.
There's no meaning to speed, because it takes nothing to get there.
There's no weight to it at all. It feels less like a car with tires and springs, and more like it's being pushed around by a giant invisible toddler. Regular cars should respond badly to being driven quickly over bricks.



Part of my choice to use slow braking and acceleration is that Blockland car controls are pretty much all or nothing, which means that driving calmly and smoothly requires a car that isn't acting like it's in a race.


Again, I will admit some fault on how exaggerated some of these have been. Depending on what kind of surface you're driving on, cars I make can behave very badly. I often test one car on one build, and make it work for me in that build, then I drive it somewhere else and wonder what the hell I was doing.

However, roads which are made of layers of plates should probably be illegal.


It's a matter of taste. It's entirely subjective. You think a certain kind of handling is fun for Blockland, I think differently. If I had to choose, I would rather drive a sluggish, slippery old beater that rolls around like its springs are mostly rust than the Jeep or, frankly, 90% of the cars Filipe, Barnabas, and NightHawk have made. When you drive one of my cars, and it isn't a race car, and you think it handles well, that's probably me compromising. (or someone editing its values to something they prefer)