Vehicle tire orientation?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Vehicle tire orientation?

Postby pHySiQuE » Sun Sep 21, 2014 6:11 pm

The Newton 4x4 matrices are oriented 90 degrees off from what we use in our engine. Is there any way to control the axis the tires rotate around? I'm just about done with our vehicle implementation.
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Vehicle tire orientation?

Postby Julio Jerez » Sun Sep 21, 2014 7:29 pm

There will never be a generic way to deal with that in a way the keep every one happy. of course from the end user view point is seem the engine should do it but other user may have different opinion.

In the tire callback you can apply a 90 degree rotation to align the tire.
I actually do the same thing for all demos.
if you look at the vehicle demos. there are three models, tow of the have the tire visual mesh rotated 90 degree Yaw angle, the other does not.

what I do is that I save the matrix with the tie user data
Code: Select all
TireAligmentTransform* const ligmentMatrix = new TireAligmentTransform (tireAligmentMatrix * aligmentMatrix);
tirePart->SetUserData(m_ligmentMatrix);


you can save anywhere you want and the in the callback you pre multiply the tire local matrix by the aligment matrix

Code: Select all
      for (CustomVehicleControllerBodyStateTire* tire = m_controller->GetFirstTire(); tire; tire = m_controller->GetNextTire(tire)) {
         DemoEntity* const tirePart = (DemoEntity*) tire->GetUserData();
         TireAligmentTransform* const aligmentMatrix = (TireAligmentTransform*)tirePart->GetUserData();
         dMatrix matrix (aligmentMatrix->m_matrix * tire->CalculateLocalMatrix());
         dQuaternion rot (matrix);
         tirePart->SetMatrix(*scene, rot, matrix.m_posit);
      }


Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Vehicle tire orientation?

Postby pHySiQuE » Sun Sep 21, 2014 8:28 pm

Actually, all I had to do was modify the mat4 sent to the vehicle create function. Works perfectly now. :mrgreen:
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Vehicle tire orientation?

Postby Julio Jerez » Sun Sep 21, 2014 8:37 pm

do you have a driving vehicle now?
if you do I think you are the first taker.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Vehicle tire orientation?

Postby pHySiQuE » Mon Sep 22, 2014 1:28 pm

Yep, got it working yesterday:
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Vehicle tire orientation?

Postby Julio Jerez » Tue Sep 23, 2014 3:20 am

You see that was not so bad was it?
Isn't it cool how much can lean sideways without rolling over and still can be responsive with out too much massaging of the data?

now all you need is some one to make a cool car model, make some simple modifications and do some tire burned out. and then then call Jay Leno. :)
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Vehicle tire orientation?

Postby manny » Tue Sep 23, 2014 5:44 am

Julio Jerez wrote:tire burnout

does that work with your current implementation? in my implementation that is something that needs to be "massaged" in to get working. because tire angular velocity is derivived from car velocity, and if the car is not moving, well, you get the point. while that could be fix, it doesn't come naturally with a raycasted car.

EDIT: btw, here is the video of the ray cast car in action. keep in mind that it's currently configured for a super arcade feeling: high friction, super brakes etc. but it's very easy to turn this into a realistic simulation by adjusting friction. the car also supports drifting (loss of traction) has a gearbox etc.
In the video I tried to show you how the springs behave, how it responds to collisions, it also leans when driving curves. however it's barely visible because of the cam which is fixed along Y-

http://www.instaLOD.io - InstaLOD - State of the art 3D optimization
manny
Site Admin
Site Admin
 
Posts: 131
Joined: Tue Feb 11, 2014 6:49 pm

Re: Vehicle tire orientation?

Postby Julio Jerez » Tue Sep 23, 2014 10:13 am

yes the video is very cool.

later I may add a lightweight vehicle like that to the vehicle controller.

The problem with very car when the move by forces applied to the body base of empirical equation o tire model and the tire kinematic is calculated for the body motion, is princely what you are getting.
some effect can no come emergent from the simulation.
stull like tire burnout and tire drifting are hard to reproduce.

if instead you calculate the tire forces, each individually and the and you plug then in to constraint solver so that the constraint figure out what force and torque the tire apply to the car body,
these effect emerge for the solver.

a tire bur out, is the effect of a torque on the tire the is larger that what kinematic friction of the can withstand.
when that happen the solve add the tire torque ands subtract the kinematic friction torque, is the value is not zero, the tire accelerate with and at a speed that will be highest or lower that the vehicle rolling effect.
notice that the effect can recreate naturally burnout but ways, by applying a high torque, or by apply high brake.
the same is for drifting, in drifting to nee to have front a rear tire acceleration ate different rate.

now once you have that, the way you apply the high torque, si the same way rear car do, you
accerate you engine on idel gear until is the engine RPM is at the pick torque, the you shift to first gear, and you get a rush of torque to the tire, that ovewhel the tire friction.

the car will start to move forward and the tire spin farter until the car speed matches the tire rolling velocity.

for drifting you the same way rear car do, you mode at some speed, the you turn left or right while shifting gear down.
when you shift gear down the tire roll a lower higher losing the sideway traction and moving faster
the to turn the wheel on the same direction that the car start to spin, and voila you get natural drifting.

just like rear cars, drifting is better with rear wheel drive car because the front tire have more lateral grip.

all these subtler effects emergent natural from the simulation using constraints. yes you pay the price of the you have to use a solver to find out the forces calculate but the solver in most case are identical to what the tire model say, but the solver also gives the solution for when the tire model is outside the steady state of the vehicle motion.

of course there are probable cheaper way to achieve the same behavior no using a complementarity solver, but I find that the cost is not so high for the simplicity and generality that you get in return.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Vehicle tire orientation?

Postby Julio Jerez » Thu Sep 25, 2014 12:30 pm

this is cool
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests