Newton 2.0x Archemedia Open Beta

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Newton 2.0x Archemedia Open Beta

Postby Julio Jerez » Sun Aug 23, 2009 9:29 pm

nothing had change is the collison code.
I do no undernat when you say teh collision is contrel by OgreNewt.
do you have debug display on?
can you make a movie?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 2.0x Archemedia Open Beta

Postby deadvirus » Mon Aug 24, 2009 8:36 am

Julio Jerez wrote:nothing had chenge is the collison code.
I do no undernat when you say teh collision is contrel by OgreNewt.
do you have debug display on?
can you make a movie?


The collision is controlled by Newton, the mesh position/orientation is controlled by OgreNewt (Ogre wrapper) in the transform callbacks I think. That's why I say that if the mesh looks right, so does the cylinder collision. Yes, I have debug display on, that's how I saw it was wrong.
I'll try to make a movie today.

Edit: Here's a video: http://www.youtube.com/watch?v=0hSdXeuuLAg the white lines are from Newton debug, the red ones are the shots. Before using 2.08 the collision was aligned with the shot.
deadvirus
 
Posts: 5
Joined: Thu Aug 06, 2009 6:57 pm

Re: Newton 2.0x Archemedia Open Beta

Postby kallaspriit » Mon Aug 24, 2009 5:03 pm

This has most probably something to do with OgreNewt or you wouldn't be the only one having problems. Can you show the code you are using to create the entity and physics object?

And you should be able to get it right using a collision modified, something along the lines:
Code: Select all
OgreNewt::ConvexCollisionPtr collision = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Cylinder(world, radius, height, 1));
OgreNewt::ConvexModifierCollision* modifiedCollision = new OgreNewt::ConvexModifierCollision(world, collision, 1);

Ogre::Quaternion rotation(Ogre::Degree(90), Ogre::Vector3::UNIT_Z);
Ogre::Vector3 rotatedScale(scale.y, scale.x, scale.z);

Ogre::Matrix4 modifierMatrix;
modifierMatrix.makeTransform(centerOffset, rotatedScale, rotation);

modifiedCollision->setScalarMatrix(modifierMatrix);

OgreNewt::ConvexCollisionPtr col(modifiedCollision);

OgreNewt::Body* body = new OgreNewt::Body(world, col, objectType);
kallaspriit
 
Posts: 216
Joined: Sun Aug 14, 2005 6:31 pm

Re: Newton 2.0x Archemedia Open Beta

Postby Julio Jerez » Mon Aug 24, 2009 5:09 pm

Hey nice looking game

My guess is that the rotation part of the matrix itself is incorrect, maybe some bad quat to matrix conversion somewhere in the rendering side..
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 2.0x Archemedia Open Beta

Postby deadvirus » Mon Aug 24, 2009 6:10 pm

I feel stupid! (really!)
I've forgot to replace the old Newton.dll file! *hits table with head*
Now it's alright.

Sorry :oops:

Julio, thanks! The game its still a little bit "raw" on the visual side, no effects and such... but that will come in time :)
deadvirus
 
Posts: 5
Joined: Thu Aug 06, 2009 6:57 pm

Re: Newton 2.0x Archemedia Open Beta

Postby rvangaal » Tue Aug 25, 2009 5:23 am

Julio Jerez wrote:Some time it is too tough askin a desigend to chaneg teh geomnety so dramatically, for what I see ther is a lot of work put into that.
...
The solution is to filter the entire singe side faces, the either create a SceneCollision, or a more than one collision tree. The two collision tree solution is two pass solutions.
...The only requirement is the you have to be able to identify those special face by some means.


I'll try to find the single-sided polygons. Normally they have a shader attached which has the 'cull=none' property, so it should be possible.
BTW the game is called 'Racer' (I should have added some extra though) and is freely available at http://www.racer.nl. There's a commercial version as well which we use internally (but then with motion platform, multiple computers, spectating etc) at http://www.hexatechracing.com

Thanks for the help, and I'll keep collision trees - I used (EDIT other engine) before and the collisions in Newton seems much less prone to exploding (although admittedly I did my own ellipsoid vs triangle soup contact generation, which probably didn't help as that is not really my area of expertise).
rvangaal
 
Posts: 61
Joined: Mon Jun 08, 2009 1:11 pm

Re: Newton 2.0x Archemedia Open Beta

Postby Julio Jerez » Tue Aug 25, 2009 9:00 am

rvangaal wrote:BTW the game is called 'Racer' (I should have added some extra though) and is freely available at http://www.racer.nl. There's a commercial version as well which we use internally (but then with motion platform, multiple computers, spectating etc) at http://www.hexatechracing.com

Oh this is racer, I have seen this game before, nice. I did not know you guy have a comercial simulator version :mrgreen: :mrgreen:

Ok this is how you can solve that problem. First I will explain why you need to do this.

Say you have two collision shapes, one is a box and the other is a flat face and they are colliding each other in a way that the box is moving with
a velocity perpendicular to the normal of the flat shape collision and hit the face edge on.
It is rare this happen but this does happen, as you see in your game.

But when this happens, Newton does not see the Box as a collection of faces, it sees it as a single solid face, an the contact is calculated such that it must lives in an overlapped voronoi regions from the two colliding shapes.
This property makes the dynamics solver generate correct contact resolution but there it come with a problem. and that is that shape must have legal vonoroi regions.

Guess what? flat polygons only have one voronnoi region, which is a beam the start at the polygon face and extend to infinity.
Therfore a flat face can with not shared edges with another faces canl only generate contacts that are perpendicular to the face.
since those are the only normal that will live in the polygon voronoi region.
This is not an imposed condition this is an emergent functionality that comes from the algorithm I use to calculate the contacts between to convex shapes.

This is why you see that the car can hit the face from the front but is goes through it when it comes from the back.
And also this is why you see huge penetration when it hit the fence edge on.
I hope you understand this because it is important to justify the solution, next I will explain the solution.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 2.0x Archemedia Open Beta

Postby Julio Jerez » Tue Aug 25, 2009 9:30 am

The solution to that problem is to do some data processing on the collision tree before you create them.
Basically it is some filtering,
Basically the idea it to generate faces with thickness in a procedural way. It is a two two passes process and You can use a collision tree as a computation geometry tool helper.

Make a collision tree and iterate over all of the faces of the mesh you are using to make the collision tree.
For each flat face copy the face to the collision tree with a inverted winding, for example if a face has indices 1, 3, 4 you add it 4, 3, 1
Remember yuo will only add the flat faces.
Then close the trees by calling collision tree end with the optimization option on. This will produce the inverted faces as an polygon soup or large convex faces.
Then using the debug display functionality, you set a callback that will give you each of the convex faces one face at a time.

in this secund part what you do is a normal extruction of the silhouette on each of this face alone the face normal.
You can pick the thickness as arbitrary value, something like 0.1 of a unit is a good values that prevent round off errors, do no use a numbe like 0.001 of some ridiculos value.
I am going to assume you know how to extrude the face surface, so I will not explain that part.
But basically what you are doing by this is making solid shapes with shared edges.

now for the secund part build another collision trees just like you are doing now, but after you add all the faces from your visual mesh then you add the extruded faces you created in the first pass.
This is: the float inverted face you get from the tree plus the thin side faces.
Note the collision tree take face with abitraty number of vertices, you do not need to triangles the extruded faces.

Then destroy the first temporary collision trees, and use the second tree as you collision shape.

Now going back to the first problem if the car hit the billboard or the fence from the back, the car will hit a face that is in the same plane but displaced but some small distance form teh front face,
this Is not too far off from reality since in reality the fence will have real sickness.
If the car hit the fence edge on, then it will hit a small flat face that will share an edge with either of the front faces of teh fence, and now the edge will a legal voronoi region.
this will produce a nice contact that the solver will use to produce good contact resolution.

I hope this is not too intrusive and if you did not understand ask me I can post some pseudo code.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 2.0x Archemedia Open Beta

Postby JernejL » Tue Aug 25, 2009 10:56 am

Julio Jerez wrote:this Is not too far off from reality since in reality the face will have real sickness.


I believe you meant "thickness" - how thick the faces are :)
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Newton 2.0x Archemedia Open Beta

Postby winstrol » Tue Aug 25, 2009 11:08 am

Hey, Julio, have you looked at the jumping car bug what I told you before?

I ported the Tutorial203_RaycastCar (stored under tutorial102 target), but it seems to be much slower than the multibody car (which is under tutorial101 target), is it normal ?
Here is the project:
http://www.insurgents.net/~winstrol/iPhoneTutorials2.zip
I addded also few other things like InitQuaternionFromMatrix, or CreateCylinder..
Up and down arrows on the screen are moving the car.

How can I added wheel steering to this Raycast solution?
User avatar
winstrol
 
Posts: 30
Joined: Fri Jul 24, 2009 9:57 pm

Re: Newton 2.0x Archemedia Open Beta

Postby Julio Jerez » Tue Aug 25, 2009 11:25 am

winstrol wrote:Hey, Julio, have you looked at the jumping car bug what I told you before?

No I have not I am in the middle of a feature, when I am ready to make the Mac build again I will check that.
I will take what you got and added it the toturials, Maybe this saturday, remind me this saturday.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 2.0x Archemedia Open Beta

Postby winstrol » Tue Aug 25, 2009 11:49 am

OK, thanks, but can u tell me something?
Is it sense to make serious car based on:
Code: Select all
-(struct iNewtonUserJoint*) DGRaycastVehicleCreate
-(void) DGRaycastVehicleAddTirefriction
-(void) DGRaycastVehicleSetTireTransformCallback
-(int) DGRaycastVehicleGetTiresCount
-(void*) DGRaycastVehicleGetTiresUserData
-(void) DGRaycastVehicleGetTireMatrix
?
If so, how can I do the wheel steer roatate in that solution?

BTW, I fixed some my mistake, and now raycast solution seems to be quick enough
User avatar
winstrol
 
Posts: 30
Joined: Fri Jul 24, 2009 9:57 pm

Re: Newton 2.0x Archemedia Open Beta

Postby Julio Jerez » Tue Aug 25, 2009 1:49 pm

you mean wheel turn to go left and right,
or wheel speeing to move forward.
you can apply a toque to the wheel, or you can even set teh angular velocity of the tire by hand and the tire will spin and move the car body apropiately.
Basically that is what the tire torque does. bu you cna jst spin youself. I do not think I ad tah functionality yet but it does work.

I resume I will add a couple more functions, now that you are working on it.
can you working this on the Mac? it is easier to develop and teh just port to the Iphone?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 2.0x Archemedia Open Beta

Postby winstrol » Tue Aug 25, 2009 6:36 pm

you mean wheel turn to go left and right,

:) yes, I mean turn to go left and right :), exactly how can I steer car to the left and right:
1> angle of wheels
2> and also how can I change the direction of car move (now I put torque to whole car, is this good way?)

But put torque to the wheels as well, now I am pushing whole car, because I thought BodySetForceAndTorqueCallback can be used only to the NewtonBodies
Can I use it to wheels in RaycastCar ? Can u show me how?

can you working this on the Mac? it is easier to develop and teh just port to the Iphone?

hmm, I do not understand enough, do you suggest me to port MacSDK solution to the iPhone ?
If so, hmm, there is no customjoint, besides, porting whole MacSDK raycastcar to the objective-c is too much for me for now (I am starting using Newton) I want to do it by little steps, I want just do the sterring the car, nothing else, Is it possible in that RayCastCar-Tutorial code?
User avatar
winstrol
 
Posts: 30
Joined: Fri Jul 24, 2009 9:57 pm

Re: Newton 2.0x Archemedia Open Beta

Postby inzar » Wed Aug 26, 2009 12:34 pm

Hello,

I have added Player Controller joint to my game project.
It works great. But when i want to add upward vertical impulse for jump, my character resisted for a while to this impulse (like friction)

After a while I get See:
if i decrease maxStairStepFactor value, this resistance decreases.

Could this normal do you think?
What should I do for jump without resistance?

PS: I'm using Newton 2.08

Thanks in advance.
inzar
 
Posts: 2
Joined: Wed Aug 26, 2009 11:29 am

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron