Unity plugin progress?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Unity plugin progress?

Postby Julio Jerez » Wed Mar 01, 2017 3:33 pm

Ok, I decided to do the vehicle next.
I am going to spend few day updating the vehicle module to use the later change in Newton core before starting making the unity component.

I think a good arena would be a small map that we can use to try think like a player controller, a vehicle, or a self balancing ragdoll.

how would like like, I do not know I am a complete moron when it come to art. when I see a cube in wire frame I always see the back first.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Unity plugin progress?

Postby misho » Wed Mar 01, 2017 3:56 pm

So, basically, a "sandbox" of sorts, with a bunch of 3D elements in it?

How do you treat the "floor" in Newton? For instance, If I give you a scene with stairs, ramps, holes, ... etc. as one 3D object, can that be used as a "floor" of the sandbox? I know you have elevation map but I was wondering if a 3D geometry can be used as a base as well.

Here is a link to a 3D Warehouse site, a depository of free Sketchup 3D models. I can easily convert the geometry to FBX. Take a look if you have time and let me know what elements you'd like to see.
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho
 
Posts: 673
Joined: Tue May 04, 2010 10:13 am

Re: Unity plugin progress?

Postby Julio Jerez » Wed Mar 01, 2017 4:14 pm

yes a sand box map would be good.
you use polygonal meshes, in unity we have a ways of grouping things by placing mesh as children if a node. later I will use that for sub material filtering
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Unity plugin progress?

Postby misho » Wed Mar 01, 2017 4:36 pm

Ok. I guess I was asking, can Newton objects interact/react with scenes like this: (and, is this what you had in mind?)

Image
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho
 
Posts: 673
Joined: Tue May 04, 2010 10:13 am

Re: Unity plugin progress?

Postby Julio Jerez » Wed Mar 01, 2017 4:47 pm

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

Re: Unity plugin progress?

Postby Julio Jerez » Sun Mar 05, 2017 8:26 pm

I am still try to bring the vehicle to work with the latest update of newton 3.14
But I am no sure what is that is making so unpredictable.
some how there is a definite side for the push the vehicle sideway and I can no find what cause it.
It is not a round error or solve error, it is definitely a problem is one of the joints, but is for the pass three day I has nod been able to identify it.

I have found other errors and made other improvement along the way, but the bug remain no matter what.
I am making simplifications to see if I can I insulated what is caused this side force pushing the car to the left.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Unity plugin progress?

Postby Julio Jerez » Sun Mar 05, 2017 10:47 pm

after lot of debugging it seem that some how the tire alignment is wrong by some tiny value
if I hack the vehicle to be a fix value the vehicle can accelerate straight indefinitely.
Code: Select all
   for (void* contact = NewtonContactJointGetFirstContact(contactJoint); contact; contact = NewtonContactJointGetNextContact(contactJoint, contact)) {
      dVector contactPoint(0.0f);
      dVector contactNormal(0.0f);

[b]// some how this direction vector seems wrong[/b]
//      const dVector& lateralPin = tireMatrix.m_front;
      dVector lateralPin (0, 0, 1,0);


I have no found any thong wrong on the calculations, but there has to be something wrong some where. In any case this is actually very bad even if I can fix it.

what this mean means is that the vehicle is unstable, in vehicle dynamics the call this condition Understeer gradient vehicle. But in stability this is called unstable equilibrium.
what this mean is that when a system is on steady state, in this case moving straight at a fix velocity)
when applying a small perturbation the system three thing can happens.
1-the system is indifferent to the perturbation, like a ball rolling on a flat floor
2-the system recover form the perturbation, like a ball rolling on a valley.
3-the system become more and more unstable, lie a ball on the top of a hill, any small change makes fall down hill.

right now the vehicle system is acting as the their condition, and what is desired is that is acct some where in between 1 and 2.

I am hopping there is a bad bug some where, but I can no find it, and I hate to have to result to hack the equilibrium.

Anyway now that It seem I have a clue as to where the bug may be, I will continue debugging it.
I am not sure how is was better before, but for what I can see this has always been that way.
what is difference now is that before there was lot of vehicle dynamics implemented on the custom joints side, now this is on the engine solver side so is much harder to debug.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Unity plugin progress?

Postby Julio Jerez » Wed Mar 08, 2017 10:56 am

I believe I yesterday I found what was the reason why the vehicle was so wrong.
in one custom joints designed to model the vehicle in one place I need to update velocity and angulate velocity
but because I copied an pasted I wrote this
NewtonBodySetVelocityNoSleep(engineBody, &engineOmega[0]);
NewtonBodySetVelocityNoSleep(engineBody, &engineVelocity[0]);

instead of this
NewtonBodySetOmegaNoSleep(differentialBody, &differentialOmega[0]);
NewtonBodySetVelocityNoSleep(differentialBody, &differentialVelocity[0]);

so the angular velocity was never updated, because is was written to the linear velocity and the overwritten.
after I found the bug I was tented to go back to the old code, but I am glad I decide to make a full revamp, because I realize I made a big mistake when I try to fused the differential and the engine into one joint. that technically work, whoever is never realistic because the differential becomes as powerful a she engine since the both use the same rigid body.
so what happen is that any slight angular velocity error on the engine get transmitted as a differential error, to the tire and the vehicle move sideway.

In real life differential gear so not amplify the torque there are just there so do addition or substation of the tire different in speed.

after that change everything seem to behave as expected.
In the test that is checked in, if you spin a rear tire with the mouse the other tire spin in the opposite direction effortlessly and if should be, wit the other method the tire spinned the engine, and the other tire.
I will add the rest for the components and check that all limit as correct before start doing the driving test, but I believe I am on the right track now.

This will be the first vehicle where all vehicle part are modeled by the newton bodies and newton joints. Technically is can be put together with joints, but there are still little things that do required
special attentions, like setting some body collision to 0, place the body part in an aggregate. modelling the engine toque curve, applying the suspension forces as external force and torque as opposing to a spring joint, and so on.
anyway I hope I get it complete some time this week.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Unity plugin progress?

Postby Julio Jerez » Wed Mar 08, 2017 4:11 pm

Sweenie

I am almost ready to start adding the vehicle model.

a while back I saw you have a demo of a car demo, actually several,
you think you can re enable then and added as a black demo at least for the first vehicle?

In unity there is a car name flycar, and on packed but I do not understand it, it seem to be full on mombo jump.
basically we need is a basically background with something that we can add four wheels and an engine.
and we can start build from that.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Unity plugin progress?

Postby Julio Jerez » Wed Mar 08, 2017 8:44 pm

ok as a test to see if the conation of joints is stable, I added a simple coulomb friction model.
and the vehicle is actually quite cool to drive.
This is a rear wheel drive, that is no ray cast, all body part are rigid bodies and joints, not cheats:D .
In the next two or three days all I have to do is focus on the implementation of the lateral and longitudinal dynamics friction model.
Bu at the print we can simulate tracks, and low speed off roads cars.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Unity plugin progress?

Postby Sweenie » Thu Mar 09, 2017 4:21 am

Julio Jerez wrote:Sweenie

I am almost ready to start adding the vehicle model.

a while back I saw you have a demo of a car demo, actually several,
you think you can re enable then and added as a black demo at least for the first vehicle?

In unity there is a car name flycar, and on packed but I do not understand it, it seem to be full on mombo jump.
basically we need is a basically background with something that we can add four wheels and an engine.
and we can start build from that.


Sure, we could use the dune buggy model i used. I can setup a basic scene with the chassi and the wheels and then we can start adding newton components to that.

But first i need to visit a doctor and fix my left eye, it feels like i have sand in it and can hardly see anything. Im squinting like Popeye right now. :shock: :roll:
Sweenie
 
Posts: 498
Joined: Mon Jan 24, 2005 7:59 am
Location: Sweden

Re: Unity plugin progress?

Postby Sweenie » Fri Mar 10, 2017 9:08 am

Actually, doesn't seem I can add the Dune Buggy... doesn't seem the license for it allows me to include it in the project like that. :cry:
But I added my simple prototype vehicle. Kind of like a "Crash test dummy" model but good for testing.
I also added the Unity test car you mentioned and changed the material a bit to give it some color and also skipped importing the scripts, particles and sound effects. Just imported the actual mesh components(with their materials).
Sweenie
 
Posts: 498
Joined: Mon Jan 24, 2005 7:59 am
Location: Sweden

Re: Unity plugin progress?

Postby Julio Jerez » Fri Mar 10, 2017 10:38 am

oh these tow are fine.

I have few vehicle model that I have collected over the years form donations form some users.

1- a viper
2- a monster truck
3- a Lamborghini.
4-I believe I have the famous public domain blue Subaru some where
we can use those.
but I did not have to go over the process of conventions the to FBX and make assets.

any what I like about model you put in is the the simple one do look like a car instead of a box.
the second has lot of body part so we, do fancy stuff like moving the suspension and steering apparatus.

what can do few demos with different degrees of complexity.
for the first one, it will be just like Unity user do car using wheel colliders.
basically a rigid body mount of wheels.
the they control it with scripts.

In our model will provide a lithe more functionality, better wheels, better suspensions, steering and brakes.
then the vehicle component will have extra sub component that will let the use associate then as they
wish.

This model is actually important because there seem to be a large base of people who made packager that build on top of such kind of models. a very popular one is call Crazy edit car, or something leke that but I have seem many on you tube. for that will use you funny car that look like fruits mount on for wheels.

The second demo we will use the sky model, and male a high performance car, this one will have the engine and all the parts.

then a third demo will be the same but will add script effect like playin sound engine, skid marks, tire burn sound and so on.


do you think you can replace the material on the flat floor? I notice people tend to use a grid pattern that seem to look interesting, I could no find anything like that. so I use a wood material that came out of the tree stuff. but that texture is no very good because only has line alone one direction, and the color looks like dog poop.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Unity plugin progress?

Postby Sweenie » Fri Mar 10, 2017 11:30 am

I added some kind of grid to the floor.
Tried to make the black lines match 1x1 meter but couldn't get it right... :roll:
Well, it's a grid though. :lol:

Got a merge conflict when checking in, hope I didn't mess anything up.
Sweenie
 
Posts: 498
Joined: Mon Jan 24, 2005 7:59 am
Location: Sweden

Re: Unity plugin progress?

Postby Julio Jerez » Fri Mar 10, 2017 2:18 pm

oh yes this is much nicer, and I did not get any conflict.
with this I will try adding the fist basic vehicle this weekend.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 18 guests