Vehicles third pass

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Vehicles third pass

Postby pHySiQuE » Wed Oct 25, 2017 6:26 am

Well, we can either change the entire game engine to fit the convention of one little part or we can change the part to match the normal way every game engine in the last ten years does things. The present implementation is not usable. If I tell my users they have to parent their model to another node and rotate it, the first thing they will ask me is why I don't just fix the vehicle orientation so it faces the right direction.
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Vehicles third pass

Postby pHySiQuE » Thu Oct 26, 2017 3:37 am

Here are a few examples why this is such a big problem:

The user drops their model into a scene, adds a vehicle script, names the model "MainVehicle" and then runs their game. Their game code looks for an object named MainVehicle and tries to use that to drive around, but the script creates another node to fix the sideways wheels problem and now the object they are looking for is not a physics vehicle. They don't understand why it doesn't work and I get a bad review on Steam.

The user wants to make a truck towing a trailer. They create two vehicles for the cab and trailer in our editor, add a hinge joint so the truck pulls the trailer, and run their game. When it doesn't work because the objects the joint was connected to are no longer physical objects, they don't understand why it doesn't work and I get a bad review on Steam.

I have to roll this out to 20,000 users before Christmas, and I have to make the decision whether to give them something that is technically impressive (your new vehicles system), but will result in angry customers who will claim that our vehicles are broken, or should I make my own simple system that is not as good but works in the way the user expects it to.
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Vehicles third pass

Postby Sweenie » Thu Oct 26, 2017 6:31 am

Hmm, maybe I'm missing something here but if it's just a case of the visual representation of the wheels being rotated 90 degrees, why can't you simply apply a 90 degree local rotation on the Y-axis of the matrix you get from the wheels body matrix?
That is, instead of trying to rotate the actual wheel body(which will most likely cause things to blow up) instead rotate the matrix you fetch before transforming your visual mesh node.
Sweenie
 
Posts: 498
Joined: Mon Jan 24, 2005 7:59 am
Location: Sweden

Re: Vehicles third pass

Postby Julio Jerez » Thu Oct 26, 2017 2:10 pm

I still have about two weeks on a functionality that I have been working for a few week now.
the I will resume the vehicle.
after I get the vehicle all finish I see if I can add a vehicle frame matrix.

what I do no get is why it is that the frame is so important, what does It matter if the x or z axis is the direction of motion. once the driver is in the vehicle he could no tell what direction he is moving.

I consider this such a minor issue that, is no world doing anything about, what is just a matter of adding a node on the scene graph hierarchy.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Vehicles third pass

Postby pHySiQuE » Sun Oct 29, 2017 11:23 am

Thank you. This will seriously make a huge difference in the ease of use for our customers. I will make a big deal out of our upgrade to Newton 3.14 in the next release, as well as the new vehicle model. In fact, our winter games tournament can be themed around racing games to celebrate the new features. :D

One thought: If it is not important to other people, why not just permanently switch the X and Z axes to match our needs? Perhaps that is easier than adding the vehicle frame?

Anyways, thank you!
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Vehicles third pass

Postby Julio Jerez » Sun Oct 29, 2017 5:34 pm

pHySiQuE wrote:One thought: If it is not important to other people, why not just permanently switch the X and Z axes to match our needs? Perhaps that is easier than adding the vehicle frame?

No.
for almost 20 years the game comunity insisted on using left handed system until they where forced to switch to right hand by modeling packages like Max and Maya, but they still instist in using the wrong coordinate system just because the graphic hardware uses the wrong system.

The condinate sytem in newton will no change.
If anything I will probably go more to the system used in the scientific simulation which is
x front, y left and z down.

an like I said this is a matter of a transformation.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Vehicles third pass

Postby JernejL » Thu Nov 02, 2017 8:36 am

Julio Jerez wrote:If anything I will probably go more to the system used in the scientific simulation which is
x front, y left and z down.

an like I said this is a matter of a transformation.


This is the most logical and sensible one, it can also be mapped to gps-like coordinates
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Vehicles third pass

Postby Julio Jerez » Tue Nov 21, 2017 7:05 pm

Ok this weekend I will do the final push in the vehicle.
Basically what you want a local frame for the chassis and for each tire.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Vehicles third pass

Postby Julio Jerez » Wed Nov 22, 2017 8:39 pm

Ok I was wrong, I can see how it can be hard to set up the vehicle with the interface that it has.
I added undocumented rotation to the engine and then I counter the effect in the demos.
That's a nightmare and just wrong on my side..

I am redesigning the interface now, the vehicle will have a local frame matrix, like is had in the pass. also the tire are passed in global space. That way there can never be different than what the end app specify.
to test it I am making a vehicle that will move sideway for a while until I get all set up.

hopefully I can get it done these weekend.
I a also hope I have time to complete the lateral dynamics stability, right now is still a hardcode value that will only work for the demo.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Vehicles third pass

Postby pHySiQuE » Thu Nov 23, 2017 5:02 pm

Ah cool, once this is in I can get it running pretty quickly. Thanks!
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Vehicles third pass

Postby Julio Jerez » Thu Nov 23, 2017 7:48 pm

I suggest that you get the latest build and try to integrate it as I am doing the new refactoring, instead of waiting for a final product and the come back with some other low lever change.
Making vehicles and in general physics modeling, is very different from writing a physic library.

A physic library, in general, is a collection of algorithm that are put together and tuned to work in certain way, there is little design decision the developer has to make other that numerical and algorithmically tuning parameter setting. Making a change you know immidiallty if it will work or not because the result will be with right or wrong or you lose performance, etc.

Modeling, and making vehicles, in particular is a very different thing, the equations that represent a vehicles are very over determined and extreme non linear.
There are lots of assumption that has to be made, some assumption are better that others, but there are assumption nevertheless.
Once you made those decisions and you write a system, coming back to make a change like the one I am doing now requires a complete redesign. So it will save a lot of going back and forward if you try it as I am moving on.

Anyway I committed the main change that allows you to put a car in for wheels in your engine.
if you look at file ..\demosSandbox\sdkDemos\demos\SuperCar.cpp
line 288 you will see

Code: Select all
      dMatrix chassisMatrix;
      chassisMatrix.m_front = dVector (1.0f, 0.0f, 0.0f, 0.0f);         // this is the vehicle direction of travel
      chassisMatrix.m_up     = dVector (0.0f, 1.0f, 0.0f, 0.0f);         // this is the downward vehicle direction
//      chassisMatrix.m_front = dVector (0.0f, 0.0f, 1.0f, 0.0f);         // this is the vehicle direction of travel
//      chassisMatrix.m_up     = dVector (0.0f, 1.0f, 0.0f, 0.0f);         // this is the downward vehicle direction
      chassisMatrix.m_right = chassisMatrix.m_front.CrossProduct(chassisMatrix.m_up);   // this is in the side vehicle direction (the plane of the wheels)
      chassisMatrix.m_posit = dVector (0.0f, 0.0f, 0.0f, 1.0f);

      // create a default vehicle
      m_controller = manager->CreateVehicle (chassisCollision, chassisMatrix, definition.m_vehicleMass, PhysicsApplyGravityForce, DEMO_GRAVITY);


if you uncomment that line that from the vehicle local matrix, the it should place a car aligned to the z axis.
Then the function dWheelJoint* AddTire now takes and global space matrix as initial transform.

If you get that sussesfully, there you should be a car in your demo.
It does not drive or anything but that's a good start.

you should be able to just use the same transform callback for the chassis and the tires if they are in global space. In the SDK demo the tires are local to the chassis so I need a special transform callback.
I do not have a way to test the z axis aligment since I do not have a model aligned that way.

so is up to you if you want to test it as I move on.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Vehicles third pass

Postby Julio Jerez » Thu Nov 23, 2017 8:14 pm

Oh also you should be able to implement the steering and the breaks, by implementing the void UpdateDriverInput(dCustomVehicleController* const vehicle, dFloat timestep)
similar to the one in teh demo.
These at the parts that are more affected by the coordinate system change. they are also the one that are more end user depended.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Vehicles third pass

Postby pHySiQuE » Fri Nov 24, 2017 1:08 pm

Okay, I am on revision 4176 and working on this now...
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Vehicles third pass

Postby pHySiQuE » Fri Nov 24, 2017 1:48 pm

Hmmm, I am looking at the custom joints source code and it looks like the vehicle frame is not used:
Code: Select all
dCustomVehicleController* dCustomVehicleControllerManager::CreateVehicle(NewtonBody* const body, const dMatrix& vehicleFrame, NewtonApplyForceAndTorque forceAndTorque, dFloat gravityMag)
{
   dCustomVehicleController* const controller = CreateController();
   controller->Init (body, forceAndTorque, gravityMag);
   return controller;
}

dCustomVehicleController* dCustomVehicleControllerManager::CreateVehicle(NewtonCollision* const chassisShape, const dMatrix& vehicleFrame, dFloat mass, NewtonApplyForceAndTorque forceAndTorque, dFloat gravityMag)
{
   dCustomVehicleController* const controller = CreateController();
   controller->Init(chassisShape, mass, forceAndTorque, gravityMag);
   return controller;
}

:| :?

But on GitHub it looks different:
https://github.com/MADEAPPS/newton-dyna ... anager.cpp

Why is TortoiseSVN not updating the library?...
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Vehicles third pass

Postby pHySiQuE » Fri Nov 24, 2017 2:05 pm

Ah okay it looks like this is the SVN URL:
https://github.com/MADEAPPS/newton-dynamics.git/trunk
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 15 guests

cron