Body setup problems

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Body setup problems

Postby Julio Jerez » Fri Jun 19, 2015 8:11 am

if you tell me what is it you are doing, maybe that will be better.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Body setup problems

Postby aitzolmuelas » Fri Jun 19, 2015 9:31 am

Julio Jerez wrote:
aitzolmuelas wrote:In the general case, what if I need to have a non-solid trigger (a viewing volume, for example) generate contacts with static/scene geometry? Am I forced to make that static geometry non-static?

you make a dynamic (with mass) body and give it Material the in the call back you reject the contacts. give a force call back the add no force.

This goes for the 'first approach'. I tried the second because I couldn't get the first to work
aitzolmuelas
 
Posts: 78
Joined: Wed Mar 25, 2015 1:10 pm

Re: Body setup problems

Postby aitzolmuelas » Fri Jun 19, 2015 9:33 am

Maybe I was not clear enough: this
aitzolmuelas wrote:NewtonWorldCriticalSectionLock( world, threadIndex );
  for( auto c = NewtonContactJointGetFirstContact( contactJoint ); c; ) {
    auto next_c = NewtonContactJointGetNextContact( contactJoint, c );
    NewtonContactJointRemoveContact( contactJoint, c );
    c = next_c;
  }
  NewtonWorldCriticalSectionUnlock( world );

is the body for the material callback (contact processing) that I setup between triggers and regular bodies
aitzolmuelas
 
Posts: 78
Joined: Wed Mar 25, 2015 1:10 pm

Re: Body setup problems

Postby Julio Jerez » Fri Jun 19, 2015 11:23 am

I do not think you nee to use NewtonWorldCriticalSectionLock, to reject a contact, if you are doing there must be a bug some where. are you using multiple threads.

also since you doing some elaborated thing, it is possible that you take one for the demos as a skeleton
and you make a mockup of what you are try to do.
the will simply the process a lot, and you will you answer quicker.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Body setup problems

Postby aitzolmuelas » Fri Jun 19, 2015 11:32 am

I tried without the critical section first and it crashed during the deletion of contact joints (I don't know if it is a bug, but Newton threads were the only ones running at that point, our engine halts all other threads while physics is updating).

I don't know if I will find time to try to mockup anything in the samples, but I don't think I am trying anything that elaborate either... All I want something equivalent to a trigger detecting static geometry (since you said that is not directly supported by Newton, and you suggested
Julio Jerez wrote:you make a dynamic (with mass) body and give it Material the in the call back you reject the contacts. give a force call back the add no force.

that is what I was trying to do).

And back to the other question,
aitzolmuelas wrote:I saw NewtonWorldCollide, which by the signature seems to be what I am looking for, but it is not implemented (it just asserts false). Is it not yet implemented, or rather obsolete?
aitzolmuelas
 
Posts: 78
Joined: Wed Mar 25, 2015 1:10 pm

Re: Body setup problems

Postby Julio Jerez » Fri Jun 19, 2015 12:29 pm

aitzolmuelas wrote:I don't know if I will find time to try to mockup anything in the samples, but I don't think I am trying anything that elaborate either... All I want something equivalent to a trigger detecting static geometry (since you said that is not directly supported by Newton, and you suggested

yes and that should be very easy to do It may be that I did not envision the combination of what you are trying. But the engine is vey flexible and I am sure what you wan can be done.
You say a Trigger detecting static geometry.

for are you using the trigger manager. because by design the manager ignore static objects.
However that can be done vey simple

1-Make a Kinematic body. and set to colloidal.
2-Give some Mass, so the place in the Dynamics side
3- In the contacts call back you should be getting contacts

is that you are doing.?
I not can you list the step of what you are doing so ta I can mick the test.

aitzolmuelas wrote:And back to the other question, I saw NewtonWorldCollide, which by the ..
that function shuuld be working I think I use in some test. but I will check it out.

some time what I add new feature or make changes, I place those assets on the depend pathway the use the functionality to remind me that this I need to tested,
It maybe the is it simple remove the assert.

Just give me the list of step you are doing to make the trigger. maybe part of the source code and clean up the stuff you do can share. this soudl be a very trivial thing to get going.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Body setup problems

Postby aitzolmuelas » Fri Jun 19, 2015 12:46 pm

Julio Jerez wrote:that function shuuld be working I think I use in some test.

this is the implementation of the method:
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)
{
   TRACE_FUNCTION(__FUNCTION__);
   
   dgAssert (0);
   return 0;
}

Ill try to cleanup code and post my setup for the triggers and how they respond
aitzolmuelas
 
Posts: 78
Joined: Wed Mar 25, 2015 1:10 pm

Re: Body setup problems

Postby Julio Jerez » Fri Jun 19, 2015 1:18 pm

Oh I do not remember what is that was function for, I suppose for colliding a simle shape against world, it think it just need to get the broad phase and make the call to update contacts.

is that what you want to use? that would definably solve your problem sicne it will make a collision only system
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Body setup problems

Postby aitzolmuelas » Mon Jun 22, 2015 4:55 am

Yes, that would be perfect: the problem with the convex cast is that sometimes I need just the collision contacts for the body in a specific location (so I am not actually casting, as in sweeping the sape from point A to B), and convex cast gives no contacts in that case. Is it possible to have NewtonWorldCollide implemented? (no hurry, I can continue working on other stuff in the meantime)
aitzolmuelas
 
Posts: 78
Joined: Wed Mar 25, 2015 1:10 pm

Re: Body setup problems

Postby Julio Jerez » Mon Jun 22, 2015 11:08 am

I will implement the function NewtonWorldCollide The function is some where in Newton 2.xx

for the time when Newton had two update functions one the did collision and one that did dynamics and collisions. The I removed the collision only.

I will find and add the function but not collision update, now the collision is complete contention free there is no nee for update loop
I think it have to be modified, because before when the was and update loop, the loop was using the material callback to report the collisions, now it will have to add a callback similar to for all object in aabb.
why do you write the prototype function declaration of what you look for and post here, that will move simple ?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Body setup problems

Postby aitzolmuelas » Mon Jun 22, 2015 11:21 am

The prototype is already there, it's the unimplemented function I mentioned earlier:

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)
{
   TRACE_FUNCTION(__FUNCTION__);
   
   dgAssert (0);
   return 0;
}


From what i see, the arguments are very similar to those of NewtonWorldConvexCast.
aitzolmuelas
 
Posts: 78
Joined: Wed Mar 25, 2015 1:10 pm

Re: Body setup problems

Postby aitzolmuelas » Tue Jun 23, 2015 6:26 am

Julio Jerez wrote:I will implement the function NewtonWorldCollide The function is some where in Newton 2.xx


I downloaded the 2.36 sources from google code and did not find the method NewtonWorldCollide. Is it from earlier versions? Or maybe it was to be a new feature in 3.0, which remains unimplemented?
aitzolmuelas
 
Posts: 78
Joined: Wed Mar 25, 2015 1:10 pm

Re: Body setup problems

Postby aitzolmuelas » Tue Jun 23, 2015 6:52 am

OK, I have seen now how I can (I think) implement the functionality calling 'foreachInAABB', I'll try that now :)
aitzolmuelas
 
Posts: 78
Joined: Wed Mar 25, 2015 1:10 pm

Re: Body setup problems

Postby Julio Jerez » Tue Jun 23, 2015 7:39 am

aitzolmuelas wrote:I downloaded the 2.36 sources from google code and did not find the method NewtonWorldCollide. Is it from earlier versions? Or maybe it was to be a new feature in 3.0, which remains unimplemented?
no, no NewtonWorldCollide, there was NewtonCollsionUpdate which did the same thing.

with ForEachBodyInAABB will do it, and would be the must efficient why way because you do no have to dot for body who are no triggers, other method will do a pat per pair full check, wich will have fast but no as fast if you just doe for the potential pairs the you are interested in.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Body setup problems

Postby aitzolmuelas » Tue Jun 23, 2015 10:39 am

Cool, I had to differentiate triggers that require collision with statics from 'regular' triggers, and did the former with the foreachAABB you suggested, but finally got it to work, thanks!
aitzolmuelas
 
Posts: 78
Joined: Wed Mar 25, 2015 1:10 pm

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 14 guests

cron