Body setup problems

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Body setup problems

Postby Marc » Sun Feb 21, 2016 8:33 pm

I'm also interested in the Implementation of NewtonWorldCollide(). In the current Version on github it still looks like this:

Code: Select all
typedef unsigned (*NewtonWorldRayPrefilterCallback)(const NewtonBody* const body, const NewtonCollision* const collision, void* const userData);

int NewtonWorldCollide (const NewtonWorld* const newtonWorld, const dFloat* const matrix, const NewtonCollision* const shape, void* const userData, 
                  NewtonWorldRayPrefilterCallback prefilter, NewtonWorldConvexCastReturnInfo* const info, int maxContactsCount, int threadIndex)
{
   TRACE_FUNCTION(__FUNCTION__);
   
   dgAssert (0);
   return 0;
}


I don't think this Version existed in 2.x, but it existed in 1.x - but did something else:

Code: Select all
int NewtonWorldCollide (const NewtonWorld* newtonWorld, int maxSize,
   const NewtonCollision* collsionA, const dFloat* matrixA, const NewtonCollision* collsionB, const dFloat* matrixB,
   dFloat* contacts, dFloat* normals, dFloat* penetration)


Somehow it calculated a collision between 2 bodies? I don't remember anymore.

However the new NewtonWorldCollide would be quite handy. I just updated from Newton 2.x to 3.x and used NewtonCollisionUpdate a lot to ask for my game logic. In Newton 3.00 I tried to do it with NewtonUpdate instead, but it is really slow compared to NewtonCollisionUpdate. I guess because it also tries to simulate the physics as well - which I don't need. So a collisions only way to use Newton would be great for me. :)
Millenium Project Enterprises - Hobbyist Gamedev Group http://www.mpe-online.org
Walkover is now on Steam => http://store.steampowered.com/app/348700/
User avatar
Marc
 
Posts: 281
Joined: Sun Mar 14, 2004 4:07 pm
Location: Germany

Re: Body setup problems

Postby Julio Jerez » Sun Feb 21, 2016 9:22 pm

why don you move to 3.14? they all exist there.
Plus there are a lot more collision functionality.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Body setup problems

Postby Marc » Sun Feb 21, 2016 11:08 pm

I meant 3.14. I copied the code from there. It's just this empty assert code there.
Millenium Project Enterprises - Hobbyist Gamedev Group http://www.mpe-online.org
Walkover is now on Steam => http://store.steampowered.com/app/348700/
User avatar
Marc
 
Posts: 281
Joined: Sun Mar 14, 2004 4:07 pm
Location: Germany

Re: Body setup problems

Postby Julio Jerez » Mon Feb 22, 2016 12:10 am

Oh you are right, there is an assert there, In what version was it ever active? so that I can see what it did and re implement it again.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Body setup problems

Postby Marc » Mon Feb 22, 2016 12:31 am

As I posted, I think it was never active. There was a function with the same name but different signature in 1.53 which did something else. The 3.x NewtonWorldCollide always just had this Assert whenever I checked.
Millenium Project Enterprises - Hobbyist Gamedev Group http://www.mpe-online.org
Walkover is now on Steam => http://store.steampowered.com/app/348700/
User avatar
Marc
 
Posts: 281
Joined: Sun Mar 14, 2004 4:07 pm
Location: Germany

Re: Body setup problems

Postby Julio Jerez » Mon Feb 22, 2016 8:50 am

Ha ok I will finish that them
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Body setup problems

Postby Marc » Mon Feb 22, 2016 1:41 pm

Ok. Cool. Thx. :)
Millenium Project Enterprises - Hobbyist Gamedev Group http://www.mpe-online.org
Walkover is now on Steam => http://store.steampowered.com/app/348700/
User avatar
Marc
 
Posts: 281
Joined: Sun Mar 14, 2004 4:07 pm
Location: Germany

Re: Body setup problems

Postby Julio Jerez » Mon Feb 22, 2016 1:51 pm

Marc wrote:
Code: Select all
int NewtonWorldCollide (const NewtonWorld* newtonWorld, int maxSize,
   const NewtonCollision* collsionA, const dFloat* matrixA, const NewtonCollision* collsionB, const dFloat* matrixB,
   dFloat* contacts, dFloat* normals, dFloat* penetration)


well the signature of the missing function is this:
Code: Select all
int NewtonWorldCollide (const NewtonWorld* const newtonWorld, const dFloat* const matrix, const NewtonCollision* const shape, void* const userData, 
                  NewtonWorldRayPrefilterCallback prefilter, NewtonWorldConvexCastReturnInfo* const info, int maxContactsCount, int threadIndex)


The idea is to calculate the Collison between that shapes and the world.

there are a functions to calculate collision between two shapes which works, because I was using it on the vehicle until I switch to convex cast the tires.
Code: Select all
int NewtonCollisionCollide (const NewtonWorld* const newtonWorld, int maxSize,
      const NewtonCollision* const collisionA, const dFloat* const matrixA,
      const NewtonCollision* const collisionB, const dFloat* const matrixB,
      dFloat* const contacts, dFloat* const normals, dFloat* const penetration,
      dLong* const attributeA, dLong* const attributeB, int threadIndex);

int NewtonCollisionCollideContinue (const NewtonWorld* const newtonWorld, int maxSize, dFloat timestep,
      const NewtonCollision* const collisionA, const dFloat* const matrixA, const dFloat* const velocA, const dFloat* omegaA,
      const NewtonCollision* const collisionB, const dFloat* const matrixB, const dFloat* const velocB, const dFloat* const omegaB,
      dFloat* const timeOfImpact, dFloat* const contacts, dFloat* const normals, dFloat* const penetration,
      dLong* const attributeA, dLong* const attributeB, int threadIndex);


these two calculate collision between two indivual shapes.
I will complete the first one thought, for some reason I never used that function, but should be easy to get it going.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Body setup problems

Postby Marc » Mon Feb 22, 2016 3:28 pm

The one you cited from me was the one from 1.53. The one you posted is the one I'm looking for. I'll use it if you implement it.
Millenium Project Enterprises - Hobbyist Gamedev Group http://www.mpe-online.org
Walkover is now on Steam => http://store.steampowered.com/app/348700/
User avatar
Marc
 
Posts: 281
Joined: Sun Mar 14, 2004 4:07 pm
Location: Germany

Re: Body setup problems

Postby Julio Jerez » Sun Feb 28, 2016 7:55 am

ok this is in now.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Body setup problems

Postby Marc » Mon Feb 29, 2016 10:37 am

ok thx. I'll try it. :)
Millenium Project Enterprises - Hobbyist Gamedev Group http://www.mpe-online.org
Walkover is now on Steam => http://store.steampowered.com/app/348700/
User avatar
Marc
 
Posts: 281
Joined: Sun Mar 14, 2004 4:07 pm
Location: Germany

Re: Body setup problems

Postby Marc » Thu Mar 02, 2017 1:18 pm

Maybe a bit late, but I wanted to say NewtonWorldCollide() works for me now. :)
Millenium Project Enterprises - Hobbyist Gamedev Group http://www.mpe-online.org
Walkover is now on Steam => http://store.steampowered.com/app/348700/
User avatar
Marc
 
Posts: 281
Joined: Sun Mar 14, 2004 4:07 pm
Location: Germany

Previous

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 11 guests