NewtonTreeCollisionGetVertexListIndexListInAABB ?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

NewtonTreeCollisionGetVertexListIndexListInAABB ?

Postby kikosmalltalk » Wed Apr 29, 2009 10:12 am

Hi all !

It my again :D

I solved the problem with the primitive (Box, Cone, Sphere and Cylinder).
But not with TreeCollision :(

The winding order in Jet3D is clock wise :
It is optimized for triangle fans. Clockwise from the top.

1-----4
|\ |
| \ |
| \ |
2-----3


Newton is counter clock wise. Right?.

I try to pass the geometry to Newton in inverse order. This work well !!.
But if I try to pass the geometry to Newton in the SAME ORDER , ALSO work well !!!.

Then I try to use the function :

NEWTON_API int NewtonTreeCollisionGetVertexListIndexListInAABB (const NewtonCollision* treeCollision, const dFloat* p0, const dFloat* p1, const dFloat** vertexArray, int* vertexCount, int* vertexStrideInBytes, const int* indexList, int maxIndexCount, const int* faceAttribute);

and I obtain the SAME VERTEXES !!.

This are the JET3D faces:

NewVec[ 726.999816894531 -90.0 -612.999877929688 ]
NewVec[ 726.999816894531 -90.0 628.000122070313 ]
NewVec[ 726.999816894531 82.0 628.000122070313 ]
NewVec[ 726.999816894531 82.0 -612.999877929688 ])

(NewVec[ -688.999938964844 82.0 628.000122070313 ]
NewVec[ -688.999938964844 -90.0 628.000122070313 ]
NewVec[ -688.999938964844 -90.0 -612.999877929688 ]
NewVec[ -688.999938964844 82.0 -612.999877929688 ])

(NewVec[ -688.999938964844 -90.0 -612.999877929688 ]
NewVec[ 726.999816894531 -90.0 -612.999877929688 ]
NewVec[ 726.999816894531 82.0 -612.999877929688 ]
NewVec[ -688.999938964844 82.0 -612.999877929688 ])

(NewVec[ 726.999816894531 82.0 628.000122070313 ]
NewVec[ 726.999816894531 -90.0 628.000122070313 ]
NewVec[ -688.999938964844 -90.0 628.000122070313 ]
NewVec[ -688.999938964844 82.0 628.000122070313 ])

NewVec[ -688.999938964844 -90.0 628.000122070313 ]
NewVec[ 726.999816894531 -90.0 628.000122070313 ]
NewVec[ 726.999816894531 -90.0 -612.999877929688 ]
NewVec[ -688.999938964844 -90.0 -612.999877929688 ])

(NewVec[ 726.999816894531 82.0 -612.999877929688 ]
NewVec[ 726.999816894531 82.0 628.000122070313 ]
NewVec[ -688.999938964844 82.0 628.000122070313 ]
NewVec[ -688.999938964844 82.0 -612.999877929688 ])


This the result faces in Newton:

////////////Newton Face Order with optimization///////////////////

(NewVec[ -688.999938964844 -90.0 628.000122070313 ]
NewVec[ -688.999938964844 82.0 628.000122070313 ]
NewVec[ -688.999938964844 -90.0 -612.999877929688 ]
NewVec[ -688.999938964844 82.0 -612.999877929688 ]

NewVec[ 726.999816894531 -90.0 628.000122070313 ]
NewVec[ 726.999816894531 82.0 -612.999877929688 ]
NewVec[ 726.999816894531 -90.0 -612.999877929688 ]
NewVec[ 726.999816894531 82.0 628.000122070313 ]

NewVec[ 0.0 -1.0 0.0 ]
NewVec[ 1.0 0.0 0.0 ]
NewVec[ 0.0 0.0 1.0 ]
NewVec[ 0.0 0.0 -1.0 ]

NewVec[ -1.0 0.0 0.0 ]
NewVec[ 0.0 1.0 0.0 ]
NewVec[ -689.099914550781 -90.0999984741211 -613.099853515625 ]
NewVec[ -688.999938964844 -90.0 -612.999877929688 ]

NewVec[ -688.999938964844 -90.0 628.000122070313 ]
NewVec[ -688.999938964844 82.0 628.000122070313 ]
NewVec[ -688.999938964844 82.0 -612.999877929688 ]
NewVec[ 726.999816894531 82.0 628.000122070313 ]

NewVec[ 726.999816894531 -90.0 -612.999877929688 ]
NewVec[ 726.999816894531 -90.0 628.000122070313 ]
NewVec[ 726.999816894531 82.0 -612.999877929688 ]
NewVec[ 727.099792480469 82.0999984741211 628.10009765625 ])



//////////////Newton Order wihtout optimization/////////////////

(NewVec[ -688.999938964844 82.0 -612.999877929688 ]
NewVec[ -688.999938964844 82.0 628.000122070313 ]
NewVec[ -688.999938964844 -90.0 -612.999877929688 ]
NewVec[ -688.999938964844 -90.0 628.000122070313 ]

NewVec[ 726.999816894531 -90.0 -612.999877929688 ]
NewVec[ 726.999816894531 -90.0 628.000122070313 ]
NewVec[ 726.999816894531 82.0 628.000122070313 ]
NewVec[ 726.999816894531 82.0 -612.999877929688 ]

NewVec[ 0.0 -1.0 0.0 ]
NewVec[ -1.0 0.0 0.0 ]
NewVec[ 1.0 0.0 0.0 ]
NewVec[ 0.0 0.0 1.0 ]

NewVec[ 0.0 0.0 -1.0 ]
NewVec[ 0.0 1.0 0.0 ]
NewVec[ -689.099914550781 -90.0999984741211 -613.099853515625 ]
NewVec[ -688.999938964844 82.0 -612.999877929688 ]

NewVec[ -688.999938964844 -90.0 -612.999877929688 ]
NewVec[ -688.999938964844 -90.0 628.000122070313 ]
NewVec[ -688.999938964844 82.0 628.000122070313 ]
NewVec[ 726.999816894531 82.0 -612.999877929688 ]

NewVec[ 726.999816894531 82.0 628.000122070313 ]
NewVec[ 726.999816894531 -90.0 628.000122070313 ]
NewVec[ 726.999816894531 -90.0 -612.999877929688 ]
NewVec[ 727.099792480469 82.0999984741211 628.10009765625 ])




Question:
If I change the winding order. Newton would not have to detect the collision of the other side of the faces ??.


TreeCollision:
________________
| detect collision |
| in side |
| ------> |
|_______________|



TreeCollision inverser order:
________________
| | detect collision out side
| | <------------
|______________ _|



Does somebody understand the question?


advanced thanks

kiko
kikosmalltalk
 
Posts: 31
Joined: Mon Dec 04, 2006 10:48 am
Location: Argentina

Re: NewtonTreeCollisionGetVertexListIndexListInAABB ?

Postby JernejL » Thu Apr 30, 2009 5:40 am

Newton trimeshes are only "one-sided", if you want a doublesided one you can use duplicate copy of the desired face on the same spot with reversed direction, but this isn't intended to be used in this way, and is glitchy if you try to move objects into such faces into the edge.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: NewtonTreeCollisionGetVertexListIndexListInAABB ?

Postby kikosmalltalk » Thu Apr 30, 2009 8:30 am

Hi delfi , all


you wrote:
Newton trimeshes are only "one-sided", if you want a doublesided one you can use duplicate copy of the desired face on the same spot with reversed direction,


I not want have "double-sided" collision detect !.I want to use TreeCollision for my level Brushes !. OK.
Now, the external tree collision(1) should detect the collision in a sense. Ok.
Then, the internal tree collision(2) should detect the collision in the other sense.

Example:
In the image you can see, 2 tree collision and 2 body, the box body collides with the tree 2, but in a mistaken way !!.
The box body should be above the tree 2, the same as sphere with the tree 1 .

Here the problem:
The faces of the Tree collision 2 are passed the newton in inverse order that the faces of Tree Collision 1.
But Tree 1 and Tree 2 detect collision in the same SENSE !!.

It doesn't import in that order I pass him the faces to Newton, the collision it is always detected in the SAME SENSE!!.

The question is: Why ?

Advanced thanks

kiko
Attachments
treeCollision.JPG
treeCollision.JPG (41.06 KiB) Viewed 2432 times
kikosmalltalk
 
Posts: 31
Joined: Mon Dec 04, 2006 10:48 am
Location: Argentina

Re: NewtonTreeCollisionGetVertexListIndexListInAABB ?

Postby kikosmalltalk » Thu Apr 30, 2009 10:36 pm

Hi ALL

Thanks , The problem is already solved :mrgreen:

kiko
kikosmalltalk
 
Posts: 31
Joined: Mon Dec 04, 2006 10:48 am
Location: Argentina


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 23 guests

cron