Compound Collision ghosting?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Compound Collision ghosting?

Postby Tuppe » Sat Feb 06, 2010 4:43 pm

Hello, I'm not sure if I can post Newton problems realting to DarkBASIC here, but I'll give it a shot as the TGC community isn't really answering my Newton questions.

So the problem is, when I create one compound object it works like it should be, but when I try to create another object using compound collision, the collision data I created in the first object is transferred to the second object too. (It is layed over the second object collision, if it has any)

Here is the code for creating the first compound object, I could use same function over and over, but I created two functions for both object to narrow down the problem.
function is called by:
Body = compound(1)
second object:
Body2 = compound2(2)

Code: Select all
function compound(Obj)
local dim compCol(4) as integer
   tempObj = FreeObject()
   clone object tempObj, 8
   NDB_BuildMatrix 0.0, 0.0, 0.0, 0.0, 0.0, 0.0
   compCol(1) = NDB_NewtonCreateConvexHull(tempObj, 1)
   NDB_AddCollisionToArray compCol(1)
   delete object tempObj

   compCol(2) = NDB_NewtonCreateCylinder(2.0,200.0)
   NDB_AddCollisionToArray compCol(2)
   
   NDB_BuildMatrix 0.0, 0.0, 0.0, -115.0, 0.0, 0.0
   compCol(3) = NDB_NewtonCreateCylinder(7.0, 40.0, 1)
   NDB_AddCollisionToArray compCol(3)
   
   playerCol = NDB_NewtonCreateCompoundCollision()
   Body = NDB_NewtonCreateBody(playerCol)
   
   ` Release the collisions, no longer needed
   for col = 1 to 3
   NDB_NewtonReleaseCollision compCol(col)
   next col
   NDB_NewtonReleaseCollision playerCol

   NDB_CalculateMIBoxSolid 150.0, 8, 8, 150
   NDB_NewtonBodySetMassMatrix Body, 150.0
   NDB_BodySetDBProData Body, PlayerObj
   NDB_BuildMatrix 0.0, rx, 0.0, 0.0, 0.0, x#
   NDB_NewtonBodySetMatrix Body
   NDB_NewtonBodySetAutoFreeze Body, 0
   NDB_NewtonBodySetDestructorCallback Body
endfunction Body


And second, I stripped it to minimal, there should be no collision data, but debug shows that it has the same collision as first object.
Code: Select all
function compound2(Obj)
   playerCol2 = NDB_NewtonCreateCompoundCollision()
   Body2 = NDB_NewtonCreateBody(playerCol2)
   
   ` Release the collisions, no longer needed
   NDB_NewtonReleaseCollision playerCol2
endfunction Body2


As you can see, I have tried to use "playerCol2" and "Body2" inside the object 2 function, trying to avoid them getting together somehow.
I believe some part of the compund object creation is missing, "NDB_NewtonReleaseCollision" is something I have payed attention to when I have tried to fix this.
Is it even possible to have different compund collision object in scene? I hope it is :|
Tuppe
 
Posts: 9
Joined: Sat Feb 06, 2010 4:13 pm

Re: Compound Collision ghosting?

Postby JernejL » Sat Feb 06, 2010 6:02 pm

Out of curiosity, is this newton 2.x or 1.53? 1.53 had a bunch of problems related to compounds (a compound could not be shared across multiple bodies), but i don't understand your problem, what exactly is the issue? can you produce a video of whatever the problem is?
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Compound Collision ghosting?

Postby Tuppe » Sat Feb 06, 2010 6:12 pm

1.53, it is the latest available for DarkBASIC as far as I know.

Problem is simply that when I create second object using compound collision, it has the same collision as the first object.

No matter what collisions I put to second object, the first object collisions will be overlayed to it.
Tuppe
 
Posts: 9
Joined: Sat Feb 06, 2010 4:13 pm

Re: Compound Collision ghosting?

Postby JernejL » Sun Feb 07, 2010 11:45 am

Oh yes, this is a known problem and a documented limitation in 1.53, you will need to create unique compounds for each body (in my experience with compounds in 1.53 they are created very fast so speed is not a issue) or upgrade to newton 2.x where this problem is no longer a issue.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Compound Collision ghosting?

Postby Tuppe » Sun Feb 07, 2010 1:16 pm

Delfi wrote:you will need to create unique compounds for each body

How does that differ from the way I'm doing it now? I make object and make collisions for it and then release them. Then I make second object and so on.

Unique compounds?

I doubt it is possible to get 2.0 in DarkBASIC unless I'd the update by myself so... I need to freeze this project before it even started -.-
Tuppe
 
Posts: 9
Joined: Sat Feb 06, 2010 4:13 pm

Re: Compound Collision ghosting?

Postby JernejL » Sun Feb 07, 2010 3:54 pm

You just need to create not only unique object but also unique collision shape of the compound to use in 1.53.

I don't know who created and / or updates the darkbasic wrapper, maybe you can find an contact the author? maybe someone else already updated the wrapper for newton 2.0?
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Compound Collision ghosting?

Postby Tuppe » Mon Feb 08, 2010 8:21 am

Delfi wrote:You just need to create not only unique object but also unique collision shape of the compound to use in 1.53.

I don't know who created and / or updates the darkbasic wrapper, maybe you can find an contact the author? maybe someone else already updated the wrapper for newton 2.0?

Hmm, I though I was creating unique collision, as I created second object without collision as you can see:
Code: Select all
function compound2(Obj)
   playerCol2 = NDB_NewtonCreateCompoundCollision()
   Body2 = NDB_NewtonCreateBody(playerCol2)

   NDB_NewtonReleaseCollision playerCol2
endfunction Body2


But it does have collision of the first object, although object number etc. variables are all different.

I think that you don't know coding in DarkBASIC, so with that part you can't help me, but if you spotted anything I could do more to "uniquenize" collision of my second object more I'd understand more what you are after.

I can't figure out how to make them more separated of each other anymore...

I try to tip the author of the 1.53 update to help me out with this more, thank you for quick answering here.
Tuppe
 
Posts: 9
Joined: Sat Feb 06, 2010 4:13 pm

Re: Compound Collision ghosting?

Postby JernejL » Mon Feb 08, 2010 11:58 am

what does the NDB_NewtonCreateCompoundCollision function do there? you have source of it?
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Compound Collision ghosting?

Postby tiresius » Mon Feb 08, 2010 12:28 pm

This shouldn't require moving to Newton 2.x version. Your function compound(Obj) looks pretty good to me at first glance.

Send email to me with your code/media which uses the function compound(Obj) a couple times with this "ghosting" and I'll take a look at it. It sounds like the compound collision array is not getting cleared but I use this myself for several compound collisions in a scene and have no problems.
An apple fell on my head and I haven't been the same since...
tiresius
 
Posts: 32
Joined: Tue Nov 09, 2004 9:15 pm

Re: Compound Collision ghosting?

Postby Julio Jerez » Mon Feb 08, 2010 11:41 pm

however I alway tell teh last remining user of teh Darkbasic wraper to update it to 2.0.

every tiem I do a google serach for news abput Newtopn I alway get peopel critizng and comparing Netwpn to otehr impemenettaion, but no want mantion teh peopel are still using
version that are simple too old, but the still wna the same level of peformance they get with newer tecnology.

I do not undersntnad why 1.53 is still in used, it has been 4 years since that version was last updated. and it should be a matter of a day or two to update it to the newer 2.0 version.
Julio Jerez
Moderator
Moderator
 
Posts: 12452
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Compound Collision ghosting?

Postby tiresius » Thu Feb 11, 2010 1:17 am

I'm truly sorry our continued use of 1.53 is a burden, Julio. The simple answer to why Darkbasic Professional is still using 1.53 Newton is this: there is not enough interest in the Darkbasic community by the people smart enough in C/C++ to wrap 2.0 Newton for that language.. And before you come to any conclusions... I am interested but just not smart enough. :( Besides, even if I had the talent I still need to devote any free time I have to my own project using Newton 1.53. I'm 10k lines in and halfway done. :)

But for some closure of this issue... it was just a problem with the darkbasic source itself. There is a wrapper command NDB_StartCompoundCollision that was not being used so an internal collision array was not being cleared, hence the "ghosting".
An apple fell on my head and I haven't been the same since...
tiresius
 
Posts: 32
Joined: Tue Nov 09, 2004 9:15 pm

Re: Compound Collision ghosting?

Postby JernejL » Thu Feb 11, 2010 5:31 am

Depending on how is NDB_StartCompoundCollision created, it might have been made too smart and it detects that your two compounds are same and then it doesn't return a new one for each call.

Try creating a compound and include a NewtonCreateNull collision within it at different coords, see if that makes it think the compounds are different and return a new one each time.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Compound Collision ghosting?

Postby Julio Jerez » Thu Feb 11, 2010 9:11 am

tiresius wrote:I'm truly sorry our continued use of 1.53 is a burden, Julio. The simple answer to why Darkbasic Professional is still using 1.53 Newton is this: there is not enough interest in the Darkbasic community by the people smart enough in C/C++ to wrap 2.0 Newton for that language.. And before you come to any conclusions... I am interested but just not smart enough. :( Besides, even if I had the talent I still need to devote any free time I have to my own project using Newton 1.53. I'm 10k lines in and halfway done. :)


In that case you may be better off using what the dark basics community is using.
you cannot keep swimming against the current, it is like they say, if you can't fight them them you must joint them,
I believe Dark Basics get lots of money from nvidia/Agea for promoting their engine in to low end users, so there is a lot of politics involve on that decision.
Nvidia and Intel invest hundreds of Millions of dollars to promote their hardware, they will package a turd sandwich to make it look like a steak sandwich and the end using will eat it.

Big and unscrupulous companies do that, don’t you remember Microsoft when they made internet explorer,
they tried to block all other browser from using PC hardware, but fortunately enough Netscape was a big enough company the MS could not buy out,
and they could demonstrate to the government that what MS was doing was a violation of the Antitrust Act by abusing their monopoly power against the small competitors.
Nvidia is doing the same thing, they by paying small private developers for using their technology and they also install unconditionally a Phyx Driver is each computer that uses nvidia card whether the end user want or not.
They make it look liek ther dominate teh PC market but it is all false, they have more intall becaus when you intall eh driver ther registation prosses count as a Phyx User an dteh need develeope liek DarkBasic
and some of the other pupular open surce to make low end demos that use that tuff. So they sponsor some key selected devepers like Darkbasics.

Business always trumps reason and logic, Dark Basic do not have enough sales to survive on his merit, so the need to use any monetary support they from sponsor to promote hardware is good source of revenue for them.

Libraries like Newton cannot pay for advertisement or sponsor any middleware developer, I can only count on people seen the superior quality of Newton.
So I am afraid that you are stuck in a Limbaugh either you use what Darkbasic uses, or you switch to another free open source library were the competition if more fear.
Julio Jerez
Moderator
Moderator
 
Posts: 12452
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Compound Collision ghosting?

Postby tiresius » Thu Feb 11, 2010 12:40 pm

Delfi wrote:Depending on how is NDB_StartCompoundCollision created, it might have been made too smart and it detects that your two compounds are same and then it doesn't return a new one for each call.

He wasn't using NDB_StartCompoundCollision which clears an internal array used by the wrapper. Easy for him to fix I already sent him updated Darkbasic source code. :)

Julio Jerez wrote:Libraries like Newton cannot pay for advertisement or sponsor any middleware developer, I can only count on people seen the superior quality of Newton.
So I am afraid that you are stuck in a Limbaugh either you use what Darkbasic uses, or you switch to another free open source library were the competition if more fear.

I recognize the superior quality of Newton that's why I've been using it for 6 years. And I've heard enough negativity towards using 1.53 that I would never ask for a bugfix. So instead of your two horrible options (switching to a buggy half-done Ageia wrapper or abandoning Newton) I will go with my own option C: QUIETLY use Newton 1.53 in Darkbasic Professional until something serious breaks it beyond repair, then learn C++ and make a wrapper for 2.0. But so far my newton game still works in 64 bit Windows7 so I should be okay for a while. :)
An apple fell on my head and I haven't been the same since...
tiresius
 
Posts: 32
Joined: Tue Nov 09, 2004 9:15 pm

Re: Compound Collision ghosting?

Postby Julio Jerez » Thu Feb 11, 2010 1:13 pm

But there are Bugs an design limitations in 1.53 that will get caught up with you down the develoment path.
when you compare 1.53 to more modern technologies, 1.53 will fall behind. 1.53 was good for its time, but it have been more than four years and it has a new replacement.

It is like comparing a steam engine to a Diesel or Gassoline engine, the steam engine could in fact be better but is not modern.
you need to compare steam engine with steam engines, similarly Newton 1.53 competitores were ODE and Tokamak, not Phyx and Havok,
Newton 2.16 is the answer to those solutions.

don't you have the source of the wraper? the conversion to 2.x should be trivial for any programmer with some relative good skills.
Julio Jerez
Moderator
Moderator
 
Posts: 12452
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 640 guests