Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark Physics & Dark A.I. & Dark Dynamix / [dark dynamix] Trying to Make working wheels is hell..

Author
Message
Alduce
21
Years of Service
User Offline
Joined: 26th Oct 2002
Location: Rama spaceship
Posted: 5th Nov 2012 17:41
hi again..
I am really getting mad trying to give some wheels to my object...

I tried ALL damn combinations about 3D position of wheels, 3D position of hull,

pivots, the DYN commands about to create a wheel and about join it on the main

body....

To say that I am in total confusion is too little.

I studied the DarkDynamix demo "vehicle" (NOT the advanced one) and I understand so and so all.

I tried to apply same method but I got a lot of strange things..
The baddest one is that my wheels sink inside the ground..


After a lot of tests and tests I back to the vehicle demo and I notice that the little vehicle is laying NOT on one meshed ground object (as the one I am using on my program) but this wehicle laying on a dedicated ground.
this dedicated ground is made using "DYN MAKE GROUND PLANE"

If I take off this "DYN MAKE GROUND PLANE" command so I obtain strange behaviour in the vehicle demo too.. like the tyres start to bouncing in a krazy way..

So, some questions:


1) Can I put a DARK DYNAMIX WHEEL on another DarkDynamix object like a CUBE or a CONVEX MESH object (my ground object) and to obtain this wheel work fine?

2) what is the right step to make a wheel joined to a body?

I am trying with these steps:
A) I make the main object and I position it on 3D coords

B) I make 3 wheels (cylinders) and I position them already in the right position to be "joined" in the main object. (I'll have just to join them using these coords)

C) I rotate the wheels object in a right way to be wheels for my main object.

D) I fix the wheels pivots...

E) I make the main body actor (a cube) and later I make the wheels actors (using DYN MAKE WHEEL command)

F) I use the join commands in ALL the way (from demo way to my modified code..)but I got just a lot of time getting mad...
SO HOW CAN I join these wheels to a main object (with own coords), using their already set coordinates???

G)When the wheels are joined to the main body so I have to remember to put the DYN WHEEL UPDATE command.


3)
I notice that the render debugger show me an arrow indicator starting from the wheel actor.. What exactly is this indicator? Is just the weigh of the wheel?
In the vehicle demo these indicators going go down as gravity but in my program these indicators going parallel to the ground, opposite than the main object orientation....



In some cases I obtained my wheels laying correctly on the ground (my ground is a static actor) and joined correctly on my main object (if the main object is pushed so the wheels show them are linked) but with a total incoordination and far from the main body object..

After over 1 hour trying to fix it then I lost this little result too.. and I no longer obtained my wheels laying on the ground but from now always sink on the ground...

I really tried hundred of code manipolations but I can't get my aircraft wheels working.. I am really near to surrender
Alduce
21
Years of Service
User Offline
Joined: 26th Oct 2002
Location: Rama spaceship
Posted: 6th Nov 2012 11:58
EDIT:
Ok, I made a SEA of experiments, changing density, mass, XYZ positions of the wheels and I got some results. Not again all problems solved but some goals.



CURRENTLY I AM USING THE "DYN MAKE GROUND PLANE" COMMAND TO GIVE A "PERFECT SPECIAL GROUND" TO MY WHEELS (remains the question : is the use of this command needful?)

AND I JOINED MY WHEELS TO THE SAME MAIN BODY WHERE I JOINED ALL OTHER AIRPLANE PARTS.

Please look at these videos:



1)FIRST VIDEO :
I using a SMALL SIZE world (1 3D pixel = 1 meter - my airplane is so and so 17 meter long)
I put my 3 wheels in the CORRECT POSITION from the main airplane body object (I joined the wheels on this object).
The result is that the FRONTAL wheel sink in the ground and start to vibrate..

But after some moments the FRONTAL wheel squirts out of the ground and drag all the airplane in the air.. when the airplane back to hit the ground you can notice the whell start to works better but after some other moments the FRONTAL WHELL sink again inside the ground...
http://www.youtube.com/watch?v=KZCMzRBoaWw




2)SECOND VIDEO :
I using a SMALL SIZE world (1 3D pixel = 1 meter) but this time I put my FRONTAL wheel in a wrong position, more near to other wheels, (obviously no airplanes has this configuration) but using this WRONG wheels configuration I can obtain the FRONTAL wheel NOT sinking inside the ground!..

If I back to compile my program putting the FRONTAL wheel back near to the correct position so I back to obtain my FRONTAL wheel sink inside the ground.
http://www.youtube.com/watch?v=SaCR6onkFrM




3)THIRD VIDEO :
In this last video I using a BIG SIZE world (1 3D pixel = 3 meters - now my airplane is so and so 50 meters long)
And I tried to enlarge the density of all the objects 'cause now these objects are more big. I tried to make this:
NOW IT'A BIG WORLD = NOW THE OBJECTS ARE WITH BIG DENSITY

So I put my 3 wheels in the CORRECT POSITION from the main airplane body object (where the wheels are joined)
and seems to working really fine! No frontal wheel sinking inside the ground here!.
http://www.youtube.com/watch?v=Ts7dx1c40n0



Please help me to understand If is better to use BIG SCALE WORLD to obtain better precise collisions and physics! (maybe is there a DYN command to raise the "collision resolution when we using a SMALL SIZE world?)

and help me to understand the logic about all that.. I really pushing my brain outside my skull..
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 6th Nov 2012 12:21
I have found that getting the correct scale for your world is pretty important. Note also that wheels are not like any other shape, they can't be any way around, the arrows must point down.

Other things to think about:

Skin width, very important for stability of the simulation, if you scale up too much then the skin width may need increasing.

Timing, look at timing information, setting to smaller sub-steps increases simulation accuracy at the expense of cpu.

Getting physics to play nice can be frustrating at times, scale, joints and timing all have optimum values for any given situation and they can be difficult to find at times. That said, once you have a little experience it becomes easier, my first vehicle took a long time to set-up but now I can set them up pretty quick.

Alduce
21
Years of Service
User Offline
Joined: 26th Oct 2002
Location: Rama spaceship
Posted: 6th Nov 2012 12:43 Edited at: 6th Nov 2012 12:48
Quote: "I have found that getting the correct scale for your world is pretty important. Note also that wheels are not like any other shape, they can't be any way around, the arrows must point down.

Other things to think about:

Skin width, very important for stability of the simulation, if you scale up too much then the skin width may need increasing.

Timing, look at timing information, setting to smaller sub-steps increases simulation accuracy at the expense of cpu.

Getting physics to play nice can be frustrating at times, scale, joints and timing all have optimum values for any given situation and they can be difficult to find at times. That said, once you have a little experience it becomes easier, my first vehicle took a long time to set-up but now I can set them up pretty quick.
"


mm really interesting.
So recapitulating:

1) To scale the world in a COORDINATE WAY (distances, density and mass) but at this point, what better? small or big size??

2) "they can't be any way around"
My english can't let me understand well what you mean.. Do you mean that the whell shape can't be perfectly ROUND?
so for example I need to use a more squared wheel?
(to let you understand what I mean, think about old Amiga or PC flight simulators wheels.. squared shape wheels!)
OR you mean the wheels can't be put too far from the main object?

3) Ok the debug arrow must to point down.

4) "Skin width".. what you mean for Skin width? Are you talking about textures?

5) timing optimization. Yea, I already notice that and I will start soon to do some experiments!

6) question: DENSITY = hardness and MASS = weight?


Thank you!
Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 6th Nov 2012 13:00 Edited at: 6th Nov 2012 13:00
Skin width is a separate setting in dynamics. It defines how much objects can go inside each other without the simulation pushing them apart. So it allows the simulation to handle collisions in a smoother way.

dynSetParameter(NX_SKIN_WIDTH,width);

Experiment with 'width' to find a value which looks ok (i.e. the objects don't overlap too much) and also results in a stable simulation. Your wheels sinking into the ground may be partly to do with skin width.

As for density and mass, they are related! So MASS is calculated from DENSITY. A low density is something like foam or air. A high density is something like metal or rock. If you set an object to a density of 1.0, an object may have a mass of 20. If you then set the density to 2.0, the object will have a mass of 40.

MASS is calculated from the density and the size of the collision object.

Keep doing your experiments. It's the best way to learn and understand how physX works!

Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 6th Nov 2012 13:06
Thanks Fallout

Quote: ""they can't be any way around" "


I just meant that the arrows need to point down

You should only set mass if you have good reason to do so(sometimes needed for ragdoll stability). Setting the density saves you from working out how heavy something should be, the mass is automatically calculated from the density and the size of the object.

Alduce
21
Years of Service
User Offline
Joined: 26th Oct 2002
Location: Rama spaceship
Posted: 6th Nov 2012 14:20 Edited at: 6th Nov 2012 14:21
Fallout and Matty H, your help is like a treasure for me!

Time to do new experiments and I will update results soon! (hoping these results will be good!)

Really BIG thanks mates!
Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 6th Nov 2012 15:42
Do post up your experiments because we're learning things too from what you're doing. I haven't played with wheels yet so anything you find out will be useful to read.

Alduce
21
Years of Service
User Offline
Joined: 26th Oct 2002
Location: Rama spaceship
Posted: 6th Nov 2012 17:58 Edited at: 6th Nov 2012 17:59
Yes Fallout, I will update my progress in next days.
Since now I following a gradual grow up of results, just hope I can continue with this rhythm 'cause the matter complexity growing up too and my brain cells already hating me..
Alduce
21
Years of Service
User Offline
Joined: 26th Oct 2002
Location: Rama spaceship
Posted: 7th Nov 2012 02:19 Edited at: 7th Nov 2012 02:30
EDIT:
Dudes after a sad massacre of a lot of my brain cells I finally got what I wanted!

Now using the little scale world (1 3D pixel = 1 meter) I got my wheels working fine too
I could not accept that I was forced to use a big scale world to make my airplane wheels working good!


I really tested a lot of things again and again, wheels shape, wheels scale, wheels density in connection with other airplane parts density, gravity, dampers and springs.. including the NX_SKIN_WIDTH parameter but the solution was incredibly the simplest/craziest in the world...

See these 2 videos, are both from the same, identical code with a damn little difference... :


In this first video my airplane born in X=0 and Z=0 coordinates
and the frontal wheel sink on the ground
http://www.youtube.com/watch?v=Pzh_xZJoSgY&feature=youtu.be


In this second video my airplane born in X=0 and Z=-20
and all wheels working PERFECTLY!
http://www.youtube.com/watch?v=TRksd_PVHgk&feature=youtu.be

The damn weird thing is that I can set Z=-19 , Z=-18, Z=-17 etc etc until Z=-10...
If I set Z=-9 the frontal wheel back to sink in the ground...



NOW the funny thing :
I use this code to set the starting position of the COMPLETE AIRPLANE and to set the frontal wheel position :



airplane_add_x# = 0
airplane_add_height# = 22
airplane_add_z# = -9
position object 9100, 0+add_x#, -5.2+add_height#, 9+add_z#


The wheel Z position MUST to be LESS THAN 0!.. (I don't know why dudes.. but is that!)
If the wheel Z position overtake the 0 value and becomes a positive value so I obtain my wheel sinking in the ground..

So just make the AIRPLANE STARTING POSITION is shifted in Z axis of the necessary value to let my frontal wheel is positioned in a negative Z position and I got my 3 wheels working perfectly

(using a big scaled world this case not happen.. or maybe happen just with enlarge scale..)

But I don't want to try to understand this damn complex numbers behaviour.. I'm just glad I got the result before becoming mad..
Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 7th Nov 2012 09:17
That's really strange! How about if you start the plane at +10 or more on the z-axis? If that works, it could be something to do with floating point maths precision. i.e. For values lower than 10 (or larger than -10) the physX maths becomes less accurate in this case.

That sounds very wrong to me though. It should behave the same at any value, excluding really extreme high values. I would recommend looking through your code as closely as possible and see if there is anything else happening. There may be a component in your world that isn't changing as you move the plane backwards on the z-axis, and it's this component combined with the plane z position that is causing it to be stable/unstable.

- Is there anything on the ground the plane interacts with?
- Is there a physX component of the plane which isn't repositioned when you move the plane back on the z-axis?
- Do you make the joints before or after you move the plane back on the z-axis?
- Are the spring settings affected by the plane position?
- Do you perform any plane setup steps after positioning the plane?

We must get to the bottom of this mystery! Post up your plane setup and positioning code if you like!

Alduce
21
Years of Service
User Offline
Joined: 26th Oct 2002
Location: Rama spaceship
Posted: 7th Nov 2012 12:29 Edited at: 7th Nov 2012 12:39
Hi mate!
I would like to clarify the following:

1)I MUST to make my AIRPLANE STARTING POSITION with the Z position as NEGATIVE so that obtain my FRONTAL WHEEL starting position IS A NEGATIVE VALUE.
No chanches to obtain my AIRPLANE STARTING POSITION with a Z positive value cause this mean the frontal wheel will be in positive position causing the sink..

And no chances to use a Z negative position that don't permit to have the frontal wheel in a negative position too.

So the FIRST important thing is that THE FRONTAL WHEEL STARTING POSITION MUST to be a negative value. All other things come after.



2) This problematic is related ONLY about the start of the simulation, when the airplane is created on the 3D space.
This does not mean that the wheels can't be in a Z positive value later in my program.
In fact after the "born" of the airplane, my wheels accepting all XYZ positions. It's a problem related to the BORN POSITION.



3) The MAIN OBJECT (where all the wheels and other airplane parts are joined) born in X=0 , Y=0+airplane_add_height#, Z=0.

The body wheels (left and right wheels) both born with a Z negative positions and the frontal wheel is the only one which should born in a positive Z positions (If I want to put it in the right position from the main body).

So this fact let happen the strange behaviour..
and I can avoid this strange behaviour just making my airplane born in a position in which ALL THE 3 WHEELS WILL BORN IN A NEGATIVE Z POSITION...
Then I simply make my airplane born position is shifted in the Z axis in a way let all wheels are with Z negative position using the start position variables.




Now your questions:


1)"- Is there anything on the ground the plane interacts with?"
Yes I put some spheres and some other object. These objects are set with physics so If one object will touch the airplane I got the physic collision.
Remember that my airplane is made by 9 objects joined. AND THE AIRPLANE IS NOT A LIMBED OBJECT. It's just a main body where I join all other airplane parts.
If I apply a force to a wing so this wing start to move and to drag other airplane parts (and this is perfectly working)
So I have not a limbed object but an airplane made by 9 pieces perfectly joined. For precision are 8 pieces joined to 1 main body.



2) "- Is there a physX component of the plane which isn't repositioned when you move the plane back on the z-axis?"
Not, all the airplane components are repositioned when I change the starting XYZ variables


3) "- Do you make the joints before or after you move the plane back on the z-axis?"
this is the code ladder from the first code line to last (before the main loop):

A)I set the starting XYZ position variables

B)I make all airplane parts and I give positions (these positions are precise position where I add the starting XYZ values.)

example :
MAKE CONE obj_numb, 10+airplane_add_x# , 0+airplane_add_height#, 12+airplane_add_z#

10,0 and 12 are the position from the main object. So I already the right position for my future joints.

You can see I am adding the starting variables to these 10,0 and 12 so I can obtain to change the main airplane position.

C) I use DYN START and I give some physics parameters:
DYN SET PARAMETER 9, 1
DYN SET PARAMETER 39, 1
DYN SET PARAMETER 28, 1
DYN SET PARAMETER 29, 1
DYN SET GRAVITY 0.0, -9.8, 0.0

D) I make ground object and I give it the physic (currently using the DYN MAKE GROUND PLANE to let my wheels enjoying a perfect and special ground:

DYN MAKE GROUND PLANE
make object plane 10000, 500,500
rotate object 10000, -90,0,0
color object 10000,rgb(50,210,10)
position object 10000,0,0,0
DYN MAKE BOX 10000, 0.0 //Static terrain

E) I make all my objects set with physics giving density value.

F) I make the joints.

G) I make COLLISIONS GROUPS (but nothing changing If I delete this piece of code)


So you can notice I make the joints only AFTER I already build and set position of my airplane parts.



4)"Are the spring settings affected by the plane position?"
Currently I am not using springs.
I just noticed that If I am using a BIG SCALE WORLD (and again not using spring settings) so my wheels are really rigid when touching ground.
If I am using a LITTLE SCALE WORLD (and again not springs set) I see my wheels as if they had a spring or a damper that link these wheels to the main object..




5) "- Do you perform any plane setup steps after positioning the plane?"
Do you mean when start loop start?
Currently I have my airplane without any controls or new setting after the main loop start.



I working to make my code less ugly and less long too and I will post it today

And dudes, really sorry for my english.. I am trying to make it more simple and understandable possible...
Alduce
21
Years of Service
User Offline
Joined: 26th Oct 2002
Location: Rama spaceship
Posted: 7th Nov 2012 13:05 Edited at: 7th Nov 2012 14:22
Here the RAR folder containing ALL the program + X objects

Please load the Contacts.dbpro main file!

In this version I using Z start position = -10 so it's working fine!

From -9 to a positive value = frontal wheel sinking inside ground..



EDIT: using Z start position = -10 so I am really at limits.. after some second may happen the frontal wheel jumping...

If you use Z start position = -20 so SURE ALL WORKS PERFECTLY

Attachments

Login to view attachments
Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 7th Nov 2012 15:04
Hi Alduce,

I didn't modify any of the code but I had a quick look through it and noticed a few things.

You don't set up the timing. The default is probably ok, but it might be worth experimenting with that.

dyn set timing (1/60.0)/4.0,4,0

Maybe experiment with:
dyn set timing (1/50.0)/4.0,4,0
dyn set timing (1/100.0)/4.0,4,0
dyn set timing (1/50.0)/8.0,8,0
dyn set timing (1/60.0)/8.0,8,0
dyn set timing (1/100.0)/8.0,8,0


I also noticed the front wheel is positioned like this ...
position object 9100, 0+add_x#, -5.2+add_height#, 9+add_z#

It's 9 + plane z. Which means when you put the plane at -10, you're putting the front wheel at -1. So it looks like it's as soon as the front wheel goes into a negative position. Interesting.


I noticed you make a ground box like this:
DYN MAKE GROUND PLANE
rem make object box 10000, 500,0,500
make object plane 10000, 500,500
rotate object 10000, -90,0,0
color object 10000,rgb(50,210,10)
position object 10000,0,0,0
DYN MAKE BOX 10000, 0.0 //Static terreno


As you're using a flat plane and turning it into a box, that may cause strange behaviour. How can the physics object have depth/thickness if the 3D plane doesn't? Try replacing the make object plane command with make object box command and see if that does anything.


Also when you set up your joints you use these settings ...
DYN JOINT DESC SET GLOBAL ANCHOR 1, 0, 0, 0
DYN JOINT DESC SET GLOBAL AXIS 1, 0, 1, 0


Experiment with the global anchor position, even though it should not matter. Try setting the global anchor position to the plane x,y,z or just move it forwards on the z-axis to see if that has any effect!

Just a few suggestions for further experimentation. Hope they help!

Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 7th Nov 2012 16:24
Lots going on here so it's hard t tell what is causing the inconsistencies.

Fallout makes some good points, having your ground as a box should help with the wheel falling through the ground, in fact it will be impossible if the box is deep enough. I will also note that height-fields(which you may use for terrain collision) also have a depth value(unlike tri-meshes) which prevents tunnelling(wheel falling through floor). The physics plane shape also has infinite depth and will not allow things to fall through.

I would guess that the reason changing the position of the wheel seems to help could be because there is less force on the wheel, too much force could force it to tunnel through the floor.

One good tip when working with wheels is to create a collision object(box) around the wheel in a way that does not affect the way the wheel contacts the surface. This is because wheel shapes only collide from below, any contacts from the side can produce undesirable results. Think of the wheel shape as an abstract simulation shape, you still may need to add a solid collision shape, this would also help with tunnelling issues.

Alduce
21
Years of Service
User Offline
Joined: 26th Oct 2002
Location: Rama spaceship
Posted: 7th Nov 2012 16:53 Edited at: 7th Nov 2012 17:17
@Fallout
Ahh really great advices to test! Timing, right ground shape and a different way to joint the wheels seems to be really cool points to make a better and stable situation. In fact it's an illocigal thing to make a flat surface and giving it a box shape..

About timing.. It's correct If I say that "the timing it's a way to let the physic engine to use more or less time to analyze and UNDERSTAND the physical scene? More time used to make this analysis so more precise the physic engine will to work. (slowing the fps obviously)" ?

I just start to test all these things this night



@Matty H
You give me the answer about the question "It's possible to obtain a terrain without using the DYN MAKE GROUND PLANE?" and the answer is positive! using the "height-fields"! (and finally I understand what is this function..)
I really want to test soon this height fields function.
I think about to make a box shape collision to the wheels as you wrote but since the DYN MAKE WHEEL already provide a density and a collision shape then I just need to add a DYN MAKE BOX command following the DYN MAKE WHEEL command?
Example:

In this case I trying to avoid to give to the wheel a double set of density so I make the box density really little.

Ok, I test this thing right now and yes, I obtain my wheel inside a box collision shape but this box shape seems to lost coordination with the wheel when the wheel is rolling in the ground...



EDIT:
Mates, with changing terrain in this way (as Fallout advice) the problem related to Z position is not longer exist!

Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 7th Nov 2012 17:05 Edited at: 7th Nov 2012 17:06
You can't make two physics shapes from the same object. I would not worry too much about the collision shape for a plane since side collisions may never happen as they do with cars.

Just to clarify, I make a box object just above the wheel, make a physics box from this and hide the object, but you may not need to do any of this unless side on collisions are causing problems.

Alduce
21
Years of Service
User Offline
Joined: 26th Oct 2002
Location: Rama spaceship
Posted: 7th Nov 2012 17:21
Ahh ok Matty now I understand you

And now the Z position problem is solved changing my terrain so all ok!
Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 7th Nov 2012 18:51 Edited at: 7th Nov 2012 18:52
Woohoo! A good lesson to learn. I have similar problems with Carnage. Often my objects fall through the floor and those floor segments are just made from planes (I make a triangle mesh style object, but probably the same problem). I'll add some thickness to those objects in the future and hopefully that'll solve my issue too.

Alduce
21
Years of Service
User Offline
Joined: 26th Oct 2002
Location: Rama spaceship
Posted: 7th Nov 2012 21:04
Quote: " Woohoo! A good lesson to learn. I have similar problems with Carnage. Often my objects fall through the floor and those floor segments are just made from planes (I make a triangle mesh style object, but probably the same problem). I'll add some thickness to those objects in the future and hopefully that'll solve my issue too. "


Yeah mate, the problem born because there was a TOTAL incompatibility between DB object depth and Physic BOX shape depth..
Exactly as you said :
Quote: "As you're using a flat plane and turning it into a box, that may cause strange behaviour. How can the physics object have depth/thickness if the 3D plane doesn't?"


Good luck for your project! and see next for new updates

Login to post a reply

Server time is: 2024-04-25 06:34:26
Your offset time is: 2024-04-25 06:34:26