TreeCollsionAddFace ?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

TreeCollsionAddFace ?

Postby kikosmalltalk » Fri Apr 17, 2009 1:44 pm

Hi All

The function NewtonTreeCollisionAddFace can add polygons of more than 3 vertexes?
Newton 1.53 Doc:
Parameters
const NewtonWorld *newtonWorld - is the pointer to the Newton world.
int vertexCount - number of vertex in vertexPtr

const dFloat *vertexPtr - pointer to an array of vertex. The vertex should consist of at least 3 floats each.

int strideInBytes - size of each vertex in bytes. This value should be 12 or larger.

int faceAttribute - id that identifies the polygon. The application can use this value to customize the behavior of the collision geometry.




Advanced thanks

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

Re: TreeCollsionAddFace ?

Postby JernejL » Fri Apr 17, 2009 6:19 pm

yes, but there's a trimeshendbuild optimization bug which happens with quads and other > 3 point faces, this was fixed in 2.0 beta.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: TreeCollsionAddFace ?

Postby kikosmalltalk » Fri Apr 17, 2009 8:33 pm

Hi Delfi

I'm using 2.0 .Only that 2.0 not have Doc.
Then I should have another problem with TreeCollsion "collision ".
Thanks

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

Re: TreeCollsionAddFace ?

Postby JernejL » Sat Apr 18, 2009 2:46 am

What kind of problem do you have? just ask here and we will try to answer.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: TreeCollsionAddFace ?

Postby kikosmalltalk » Mon Apr 20, 2009 9:08 am

Hi Delpi

Look this:
http://www.youtube.com/watch?v=B0AGEzVoPxU

The body penetrates slowly.
kikosmalltalk
 
Posts: 31
Joined: Mon Dec 04, 2006 10:48 am
Location: Argentina

Re: TreeCollsionAddFace ?

Postby kikosmalltalk » Mon Apr 20, 2009 10:51 am

Hi all

I added a floor body and happens the same !.
look this:

http://www.youtube.com/watch?v=rFMunew0vpM


My code:

NewtonPhysicsManager>>initialize
"Initialize the receiver"

| treeCollision extBox |
world := NewtonWorld new.
world
defaultPlatformArchitecture;"0"
defaultSolverModel; "1"
defaultThreadCount;"0"
defaultFrictionModel."adaptative"
treeCollision := NewtonWorldParser parse: self parent currentSpace to: world.
extBox := treeCollision defaultCalculateAABB.
level := NewtonRigidBody in: world withCollision: treeCollision.
level matrix: NewtonMatrix identity.
treeCollision release.
world size: extBox origin asNewtonVector corner: extBox corner asNewtonVector.

createBoxBody>>createBoxBody
"Create a Box body primitive"

| actor volume |
actor := self parent currentSpace actors first.
volume := actor dynamicExtBox asVolume.
collision := self createBoxFrom: volume.
body := NewtonRigidBody in: self world withCollision: collision.
self collision: nil. "Release collision"
body
massMatrix: 100.0
inertiaX: 1.0
inertiaY: 1.0
inertiaZ: 1.0;
setForceAndTorqueCallback: body;
setTransformCallback: actor

>>createFloorBody
"Create a floor body primitive"

| matrix |
matrix := JetXForm identity.
matrix position: (JetVector3D new y: -70).
collision := self createFloorCollision.
floor := NewtonRigidBody in: self world withCollision: self collision.
self collision: nil."Release collsion"
floor matrix: matrix asNewtonMatrix.


>>createFloorCollision

^NewtonBox
world: self world
sizeX: 200
sizeY: 10
sizeZ: 200

I look at the FAQ :
The collision tree does not seem to work correctly?

I thought that it could be something of this:
-faces been passed with the incorrect winding,
-incorrect coordinate system,

But it passes the same thing between two common rigid bodies"Not TreeCollision body"
On this:
-incorrect coordinate system. How is the simulation affected?
On this:
-faces been passed with the incorrect winding.
I pass the vertexes in both senses and happens the same !!.


Advanced thanks

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

Re: TreeCollsionAddFace ?

Postby JernejL » Tue Apr 21, 2009 3:49 am

How are you applying the gravity force? which function are you using? it should be NewtonBodyAddForce, show us how you apply it.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: TreeCollsionAddFace ?

Postby kikosmalltalk » Tue Apr 21, 2009 8:04 am

Hi Delfi

How are you applying the gravity force? which function are you using?


I was using NewtonBodySetForce.
Now I change to NewtonBodyAddForce, but happens the same !!.

NewtonRigidBody>>applyGravityForce: pNewtonBody timeStep: value threadIndex: int
"Apply gravity force to the receiver"

self addForce: (NewtonVector new y: (self mass * -9,8))

NewtonRigidBody>>addForce: aNewtonVector
"Add the net force applied to a rigid body.
NOTE: This function is only effective when called from NewtonApplyForceAndTorque callback "

self dll newtonBody: self asParameter addForce: aNewtonVector

I download Newton 2.0 form here http://www.newtondynamics.com/downloads%20...%20n-2.00.rar
Is it the last version?

Now I added mass to the floor body and happens this:
http://www.youtube.com/watch?v=QcdhZrJ-9xY


The collision is detected !. But not work well !

Advanced thanks

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

Re: TreeCollsionAddFace ?

Postby JernejL » Tue Apr 21, 2009 11:00 am

This should not happen with ADDFORCE, also what code syntax is that? and did you base your code on any existing ogre tutorial?
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: TreeCollsionAddFace ?

Postby kikosmalltalk » Tue Apr 21, 2009 1:45 pm

Hi delfi

also what code syntax is that?

Is Smalltalk, in this case Dolphin Smalltalk http://www.object-arts.com/.

and did you base your code on any existing ogre tutorial?


I know the OgreNew tutorial.
I don't find something different to my code.
Could this be some bug species?

Any idea ?

Julio ?

Advanced thanks

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

Re: TreeCollsionAddFace ?

Postby kikosmalltalk » Wed Apr 22, 2009 1:23 pm

Hi All

I added a sphere and work !!!.

Look this:
http://www.youtube.com/watch?v=HXp0vDDaqJg

Can this be a bug in NewtonBox?

My code:
Code: Select all
createBoxBody
   "Create a Box collision primitive"

   | collision |
   
   collision := NewtonBox in: self world
                             size: (NewtonVector
                                           x: 40
                                    y: 60
                                    z: 40)
   body := NewtonRigidBody in: self world withCollision: collision.
   body
      massMatrix: 100.0
         inertiaX: 1.0
         inertiaY: 1.0
         inertiaZ: 1.0;
      matrix: (NewtonMatrix  identity );
      setForceAndTorqueCallback: self body;
      setTransformCallback: actor



Any idea ?

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

Re: TreeCollsionAddFace ?

Postby kikosmalltalk » Wed Apr 22, 2009 1:25 pm

Hi

The release of the collision is done, in the message #in:withCollision .


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

Re: TreeCollsionAddFace ?

Postby kikosmalltalk » Wed Apr 22, 2009 5:34 pm

Hi All

It's me again :D .
I added more primitives and happens this:

http://www.youtube.com/watch?v=FlGWhJ4gpAE

I look at the FAQs and I make sure of :
My matrix is OK.

I'm adding faces of 4 vertexes !. Can the problem be this?

On the winding order:
I worked with Genesis3D and Newton. I added the faces in inverse order with Genesis and Newton !.
Jet3D is the same that Genesis3D. So I add the vertexes in invested order.

face Example:
(1,0,1) (1,1,1) (1,1,0) (1,0,0). Jet order.
Add to NGD (1,0,0)(1,1,0) (1,1,1)(1,0,1). Right ?.

I try add the vertexes in the same order that Jet3D and happens the same !!!.

Nobody primitive one it works well!. Except the sphere !!.


Any idea ?

advanced thanks

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

Re: TreeCollsionAddFace ?

Postby kikosmalltalk » Thu Apr 23, 2009 3:44 pm

Hi All :(

For this moment I leave the treeCollsion.
I try with NewtonBox and NewtonCone. I added a NewtonBox like floor and a NewtonCone for test the collision.
Happens this:

http://www.youtube.com/watch?v=J2EKuX1Ete8

It seems to have collision defects between the cones, also between cones and box !.

Cone code:
Code: Select all
>>addCone
   "Create a Cone collision primitive"

   | collision actor matrix inertia newtonBody |
   matrix := NewtonMatrix identity.
   actor := self parent currentSpace actors first."The actor is not rendering"
   collision := NewtonCone
            in: self world
            radius: 5.0
            height: 20.0.
   newtonBody := NewtonRigidBody in: self world withCollision: collision.
   inertia := 2.0 / 5.0 * 100 * 20 * 20.
   newtonBody
      matrix: matrix;
      massMatrix: 100.0
         inertiaX: inertia
         inertiaY: inertia
         inertiaZ: inertia;
      setForceAndTorqueCallback: newtonBody;
      setTransformCallback: actor.
   self addBodies: newtonBody


I read each one of the bug in the forum, but I don't find explanation.

Any idea ?

Advanced thanks

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

Re: TreeCollsionAddFace ?

Postby Julio Jerez » Sat Apr 25, 2009 1:43 pm

it looks like you are using a back matrix.
are you using scale with you model matrices?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Next

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 18 guests