User mesh doesn't work

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: User mesh doesn't work

Postby PJani » Tue Nov 19, 2013 6:14 pm

Try to add more than one usermesh - three or more and then remove them. :?
I havent test this teory...i need to go to sleep.
| i7-5930k@4.2Ghz, EVGA 980Ti FTW, 32GB RAM@3000 |
| Dell XPS 13 9370, i7-8550U, 16GB RAM |
| Ogre 1.7.4 | VC++ 9 | custom OgreNewt, Newton 300 |
| C/C++, C# |
User avatar
PJani
 
Posts: 448
Joined: Mon Feb 02, 2009 7:18 pm
Location: Slovenia

Re: User mesh doesn't work

Postby Julio Jerez » Tue Nov 19, 2013 6:16 pm

also there few bug in yor last code fragment, you are detroying a child collision that you did not create, and
you are doin more work than it is need it, you can call begin do all the work and teh call end
here si the refacyed and correct version

Code: Select all
NewtonBody* nb = getOgreNewtBody()->getNewtonBody();
NewtonCollision* const nc_root = NewtonBodyGetCollision(nb);
NewtonSceneCollisionBeginAddRemove(nc_root);
for(int i=0;i<2;i++){
    NewtonCollision* col = NewtonCreateNull(universe->getPhysicsManager()->getWorld()->getNewtonWorld());
    NewtonSceneCollisionRemoveSubCollision(nc_root, col);
}
NewtonSceneCollisionEndAddRemove(nc_root);
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: User mesh doesn't work

Postby PJani » Tue Nov 19, 2013 6:20 pm

this was just for testing...
| i7-5930k@4.2Ghz, EVGA 980Ti FTW, 32GB RAM@3000 |
| Dell XPS 13 9370, i7-8550U, 16GB RAM |
| Ogre 1.7.4 | VC++ 9 | custom OgreNewt, Newton 300 |
| C/C++, C# |
User avatar
PJani
 
Posts: 448
Joined: Mon Feb 02, 2009 7:18 pm
Location: Slovenia

Re: User mesh doesn't work

Postby Julio Jerez » Tue Nov 19, 2013 6:28 pm

ha ok, tha bug was also on my test funtion, I edite teh bug.
also when added three shapes chidl shapes I was able to have the assert happens, I am fixing it now.
I beleiev teh bug is on the assert, becaus ethat funtion is use on many other places, I am verifying that.

if you continue does the code crashes?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: User mesh doesn't work

Postby Julio Jerez » Tue Nov 19, 2013 6:48 pm

Ok I beleive it is fixed now, please sync and try again. let me know what teh perofemce is using the scene
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: User mesh doesn't work

Postby PJani » Wed Nov 20, 2013 5:38 am

Now I get lastBox >= 0 assertion(check the prev atachment).
| i7-5930k@4.2Ghz, EVGA 980Ti FTW, 32GB RAM@3000 |
| Dell XPS 13 9370, i7-8550U, 16GB RAM |
| Ogre 1.7.4 | VC++ 9 | custom OgreNewt, Newton 300 |
| C/C++, C# |
User avatar
PJani
 
Posts: 448
Joined: Mon Feb 02, 2009 7:18 pm
Location: Slovenia

Re: User mesh doesn't work

Postby Julio Jerez » Wed Nov 20, 2013 8:12 am

Ha yes, when the scene has only one node, that was the most dangerous.
Fixed, sync again please
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: User mesh doesn't work

Postby PJani » Wed Nov 20, 2013 8:22 am

Yep now it works :)

I must say the performance is at least 20 times better than using bodies!

I was wondering is there any way to pass some pointer to the raycast query function and access it in usermesh callback? i would need to pass some parameters to the raycast callback when i search in usermesh.
| i7-5930k@4.2Ghz, EVGA 980Ti FTW, 32GB RAM@3000 |
| Dell XPS 13 9370, i7-8550U, 16GB RAM |
| Ogre 1.7.4 | VC++ 9 | custom OgreNewt, Newton 300 |
| C/C++, C# |
User avatar
PJani
 
Posts: 448
Joined: Mon Feb 02, 2009 7:18 pm
Location: Slovenia

Re: User mesh doesn't work

Postby Julio Jerez » Wed Nov 20, 2013 9:24 am

does not the ray cast has that? you pass function callback and user data, do you get that?
I did not understand that question.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: User mesh doesn't work

Postby PJani » Wed Nov 20, 2013 9:27 am

Ah nevermind i found another better solution :) I dont need to pass stuff to raycast usermesh callback
| i7-5930k@4.2Ghz, EVGA 980Ti FTW, 32GB RAM@3000 |
| Dell XPS 13 9370, i7-8550U, 16GB RAM |
| Ogre 1.7.4 | VC++ 9 | custom OgreNewt, Newton 300 |
| C/C++, C# |
User avatar
PJani
 
Posts: 448
Joined: Mon Feb 02, 2009 7:18 pm
Location: Slovenia

Re: User mesh doesn't work

Postby PJani » Wed Nov 20, 2013 11:23 am

I cant belive how well it works, thank you for your help :D
Only loading of the world is missing to complete world generation. :)

Now to another thing... :P
About materials in usermesh. As i understand they are face specific(each triangle has its own material)...

Well my materials are vertex specific and they are actually blended/interpolated, this means if you take a triangle and its vertexes and one point on the triangle you will get blended values of each three points.

What would you suggest because I can't use your system for this task. Just use custom material handler?
| i7-5930k@4.2Ghz, EVGA 980Ti FTW, 32GB RAM@3000 |
| Dell XPS 13 9370, i7-8550U, 16GB RAM |
| Ogre 1.7.4 | VC++ 9 | custom OgreNewt, Newton 300 |
| C/C++, C# |
User avatar
PJani
 
Posts: 448
Joined: Mon Feb 02, 2009 7:18 pm
Location: Slovenia

Re: User mesh doesn't work

Postby Julio Jerez » Wed Nov 20, 2013 2:08 pm

Glad you like it :) , Newton 3.xx is designed with Game play in mind.
the scene collision makes handling of stuff very much in the same way tat video games handle traditonal game level scene.
and I will exended more

for teh materials, in the contact callback you can get the is pointe to teh face indeces, for ther you can get the vertices, and indeces that was use to generate the faces. basically I used for dis[lay only teh face in teh AABB of the collision shape.
I will made teh demo to show the face wi th vetex color, form ther you cna buidl your funtionality, I thonk

this is a feaure that I do not use i a very long time, since 1.53 it may be broken
I see if adapat the usermesh demo to use that futionality again.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: User mesh doesn't work

Postby Layla » Wed Nov 20, 2013 2:16 pm

Sorry if it's already been brought up but is anyone having any problems with convex casting against a user mesh? It just never works, maybe its my user mesh at fault but physics works completely fine.
Layla
 
Posts: 54
Joined: Sat Sep 28, 2013 11:56 am

Re: User mesh doesn't work

Postby Julio Jerez » Wed Nov 20, 2013 2:46 pm

there is no reason why it would no work. once to buidl teh faces in te hcall back, it should just work.

Oh, yo umay be right, I thopnk I have to complete a function in the broaphace for that. I will verufy.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: User mesh doesn't work

Postby Layla » Wed Nov 20, 2013 2:59 pm

Thanks. Also I've always wondered, why is the hit fraction always 1.2f when nothing is hit? What does 1.2f relate to?
Layla
 
Posts: 54
Joined: Sat Sep 28, 2013 11:56 am

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests