convex cast problem

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: convex cast problem

Postby hamsterexplosion » Sun Nov 03, 2013 11:52 am

ok, i've found the solution to my problem. the reason was something not obvious for me: i passed to NewtonWorldConvexCast the matrix taken from a dynamic body (with NewtonBodyGetMatrix), that had a reoriented cylinder collision. and i created the same reoriented collision to pass to NewtonWorldConvexCast. what i made to solve my problem is not to orient collisions at all, but orient the body (when passing matrix to NewtonCreateDynamicBody).
as i understood, when i use NewtonBodyGetMatrix, it takes a body collision offsetMatrix to account?

p.s. now gonna try vs 2010 to see if other problems disapear

Julio Jerez wrote:I am very surprise of what you are saying, because I use VS 2008 and my primary compiler, how will it build for me n\and no for you, does not make sense.

i searched some internet and read that you probably have vs 2008 with sp1, while i have an original one
User avatar
hamsterexplosion
 
Posts: 20
Joined: Thu Jul 11, 2013 11:54 am
Location: ukraine

Re: convex cast problem

Postby Julio Jerez » Sun Nov 03, 2013 1:33 pm

hamsterexplosion wrote:what i made to solve my problem is not to orient collisions at all, but orient the body (when passing matrix to NewtonCreateDynamicBody).
as i understood, when i use NewtonBodyGetMatrix, it takes a body collision offsetMatrix to account?


no, no, no, that's no a solution, the ability to reorient the local matrix of a shape if a fundamental feature of the collision system. if you decide to simple use identity matrix for collision shape, than your range of functionality will be very limited.
for example a compound collision uses the local matrix to position the shape relative to the parent.

after I am done with the compound casting, I will modify the demo to reorient the local matrix and see if there is a bug there.

I suggest you get the later update of Visual studio so that you can run the SDK demos. the demo are a source of example for people to get start it form.
try getting visual studio 2010.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: convex cast problem

Postby Julio Jerez » Sun Nov 03, 2013 1:59 pm

@Bird, ok now I believe I have the compound vs (single convex, other compound and collision tree) all going.
Please see if this work for you now.

@hamsterexplosion
Now Il will modify so it set a non identity matrix, and cats a cylinder to see if there is a bug there.
are you setting a 90 degree rotation matrix to make the cylinder upright? is that what you are doing?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: convex cast problem

Postby hamsterexplosion » Sun Nov 03, 2013 2:00 pm

Julio Jerez wrote:if you decide to simple use identity matrix for collision shape, than you range of functionality will be very limited.

i decided not to use it in this particular case when i use the convex cast, i had no any problems with it before.

now i'm trying to compile on vs2010. successfully compiled the sandBox and it works much better, but still failing some times on cylinder and chamfered cylinder as seen on attachment.

as for newton engine, i can't link it compiled in vs2010, and a size of newton.lib embarrasing me (600k compared to 7megs when compiling in 2008). still trying to figure out what am i doing wrong
Attachments
1.jpg
1.jpg (223.58 KiB) Viewed 4369 times
User avatar
hamsterexplosion
 
Posts: 20
Joined: Thu Jul 11, 2013 11:54 am
Location: ukraine

Re: convex cast problem

Postby hamsterexplosion » Sun Nov 03, 2013 2:00 pm

Julio Jerez wrote:are you setting a 90 degree rotation matrix to make the cylinder upright? is that what you are doing?
yep
User avatar
hamsterexplosion
 
Posts: 20
Joined: Thu Jul 11, 2013 11:54 am
Location: ukraine

Re: convex cast problem

Postby Julio Jerez » Sun Nov 03, 2013 2:25 pm

7 meg dll? the Visual studio libraries are even small than the VS 2010, the are about 600k
I do no know what is that you are doing, you have very wired stuff that I have never seeing.

has you sync to svn? because I swept that collide all over the scene and I did not see any problem?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: convex cast problem

Postby hamsterexplosion » Sun Nov 03, 2013 2:43 pm

not dll, the static library
User avatar
hamsterexplosion
 
Posts: 20
Joined: Thu Jul 11, 2013 11:54 am
Location: ukraine

Re: convex cast problem

Postby Julio Jerez » Sun Nov 03, 2013 2:56 pm

the static library size does not count because of all the extra info that is added to it.

still you do not have the latest build for SVN, because the image you posted is not what is check it, please sync to the late SVN so that we are on the same code base.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: convex cast problem

Postby hamsterexplosion » Sun Nov 03, 2013 3:01 pm

just updated to 1198. compiled sand box, but when i choose convex cast demo it brakes. here's a call stack:
Code: Select all
>   demosSandbox_d.exe!dgArray<int>::operator[](int i=-1)  Line 94 + 0x23 bytes   C++
    demosSandbox_d.exe!dgPolygonSoupDatabaseBuilder::dgPolygonSoupDatabaseBuilder(const dgPolygonSoupDatabaseBuilder & source={...})  Line 157 + 0x15 bytes   C++
    demosSandbox_d.exe!dgPolygonSoupDatabaseBuilder::End(bool optimize=true)  Line 472   C++
    demosSandbox_d.exe!dgCollisionBVH::EndBuild(int optimize=1)  Line 94   C++
    demosSandbox_d.exe!NewtonTreeCollisionEndBuild(const NewtonCollision * const treeCollision=0x01befbe0, int optimize=1)  Line 3451   C++
    demosSandbox_d.exe!CreateCollisionTree(NewtonWorld * world=0x0488e1e0, DemoEntity * const entity=0x04838028, int materialID=0, bool optimize=true)  Line 1013 + 0x14 bytes   C++
    demosSandbox_d.exe!CreateLevelMeshBody(NewtonWorld * const world=0x0488e1e0, DemoEntity * const ent=0x04838028, bool optimize=true)  Line 1025 + 0x14 bytes   C++
    demosSandbox_d.exe!AddStaticMesh(DemoEntityManager * const scene=0x01be2520)  Line 345 + 0x15 bytes   C++
    demosSandbox_d.exe!ConvexCast(DemoEntityManager * const scene=0x01be2520)  Line 371 + 0x9 bytes   C++
    demosSandbox_d.exe!NewtonDemos::LoadDemo(int index=7)  Line 512 + 0x1a bytes   C++
    demosSandbox_d.exe!NewtonDemos::OnRunDemo(wxCommandEvent & event={...})  Line 675   C++
    demosSandbox_d.exe!wxAppConsoleBase::HandleEvent(wxEvtHandler * handler=0x01bc7c08, void (wxEvent &)* func=0x00401726, wxEvent & event={...})  Line 591 + 0xf bytes   C++
    demosSandbox_d.exe!wxAppConsoleBase::CallEventHandler(wxEvtHandler * handler=0x01bc7c08, wxEventFunctor & functor={...}, wxEvent & event={...})  Line 603 + 0x22 bytes   C++
    demosSandbox_d.exe!wxEvtHandler::ProcessEventIfMatchesId(const wxEventTableEntryBase & entry={...}, wxEvtHandler * handler=0x01bc7c08, wxEvent & event={...})  Line 1333 + 0x29 bytes   C++
    demosSandbox_d.exe!wxEventHashTable::HandleEvent(wxEvent & event={...}, wxEvtHandler * self=0x01bc7c08)  Line 939 + 0x11 bytes   C++
    demosSandbox_d.exe!wxEvtHandler::TryHereOnly(wxEvent & event={...})  Line 1524 + 0x25 bytes   C++
    demosSandbox_d.exe!wxEvtHandler::TryBeforeAndHere(wxEvent & event={...})  Line 3339 + 0x2d bytes   C++
    demosSandbox_d.exe!wxEvtHandler::ProcessEventLocally(wxEvent & event={...})  Line 1457 + 0xc bytes   C++
    demosSandbox_d.exe!wxEvtHandler::ProcessEvent(wxEvent & event={...})  Line 1430 + 0xc bytes   C++
    demosSandbox_d.exe!wxEvtHandler::SafelyProcessEvent(wxEvent & event={...})  Line 1537 + 0x13 bytes   C++
    demosSandbox_d.exe!wxWindowBase::HandleWindowEvent(wxEvent & event={...})  Line 1497   C++
    demosSandbox_d.exe!wxMenuBase::SendEvent(int itemid=6071, int checked=1)  Line 658 + 0xf bytes   C++
    demosSandbox_d.exe!wxFrameBase::ProcessCommand(wxMenuItem * item=0x01c4f4d8)  Line 281   C++
    demosSandbox_d.exe!wxFrame::HandleCommand(unsigned short id=6071, unsigned short cmd=0, HWND__ * control=0x00000000)  Line 819 + 0xc bytes   C++
    demosSandbox_d.exe!wxFrame::MSWWindowProc(unsigned int message=273, unsigned int wParam=6071, long lParam=0)  Line 928   C++
    demosSandbox_d.exe!wxWndProc(HWND__ * hWnd=0x00060484, unsigned int message=273, unsigned int wParam=6071, long lParam=0)  Line 2711 + 0x1e bytes   C++
    user32.dll!7e368734()    
    [Frames below may be incorrect and/or missing, no symbols loaded for user32.dll]   
    user32.dll!7e368816()    
    user32.dll!7e3689cd()    
    user32.dll!7e3696c7()    
    demosSandbox_d.exe!wxGUIEventLoop::ProcessMessage(tagMSG * msg=0x0012fd08)  Line 273 + 0xc bytes   C++
    demosSandbox_d.exe!wxGUIEventLoop::Dispatch()  Line 333 + 0x13 bytes   C++
    demosSandbox_d.exe!wxEventLoopManual::ProcessEvents()  Line 117 + 0xf bytes   C++
    demosSandbox_d.exe!wxEventLoopManual::Run()  Line 159 + 0x8 bytes   C++
    demosSandbox_d.exe!wxAppConsoleBase::MainLoop()  Line 314 + 0x27 bytes   C++
    demosSandbox_d.exe!wxAppConsoleBase::OnRun()  Line 255 + 0x12 bytes   C++
    demosSandbox_d.exe!wxAppBase::OnRun()  Line 285   C++
    demosSandbox_d.exe!wxEntryReal(int & argc=1, char * * argv=0x01b9be90)  Line 472 + 0x1d bytes   C++
    demosSandbox_d.exe!wxEntry(int & argc=1, char * * argv=0x01b9be90)  Line 189 + 0xd bytes   C++
    demosSandbox_d.exe!wxEntry(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * __formal=0x00000000, HINSTANCE__ * __formal=0x00000000, int nCmdShow=1)  Line 416 + 0x10 bytes   C++
    demosSandbox_d.exe!WinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, char * __formal=0x00151f4a, int nCmdShow=1)  Line 204 + 0x16 bytes   C++
    demosSandbox_d.exe!__tmainCRTStartup()  Line 275 + 0x2c bytes   C
    demosSandbox_d.exe!WinMainCRTStartup()  Line 189   C
    kernel32.dll!7c817067()    
    demosSandbox_d.exe!wxGetUserId()  Line 456 + 0xf bytes   C++
    3bf8558b()   

User avatar
hamsterexplosion
 
Posts: 20
Joined: Thu Jul 11, 2013 11:54 am
Location: ukraine

Re: convex cast problem

Postby hamsterexplosion » Sun Nov 03, 2013 3:24 pm

btw, i compiled my project only after added these lines:
Code: Select all
#pragma comment( lib, "newton/core.lib" )
#pragma comment( lib, "newton/physics.lib" )
#pragma comment( lib, "newton/ai.lib" )
#pragma comment( lib, "newton/pthread.lib" )

is that ok for vs2010?

anyway it brakes at same line that the sandBox
User avatar
hamsterexplosion
 
Posts: 20
Joined: Thu Jul 11, 2013 11:54 am
Location: ukraine

Re: convex cast problem

Postby Julio Jerez » Sun Nov 03, 2013 4:14 pm

Oh, sorry there was a missing asset, sync and try again please
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: convex cast problem

Postby hamsterexplosion » Sun Nov 03, 2013 4:33 pm

lol, just was going to write you about ramp.off

ok, i see.
it still misses sometimes. it is almost impossible to get this bug by just single-clicking, try to drag with right button over this edge at this view
Attachments
1.jpg
1.jpg (90.96 KiB) Viewed 4349 times
User avatar
hamsterexplosion
 
Posts: 20
Joined: Thu Jul 11, 2013 11:54 am
Location: ukraine

Re: convex cast problem

Postby Julio Jerez » Sun Nov 03, 2013 5:44 pm

I see, I check in the demo with a had code location when it fail to can the Big Box that is in the front, and cast the collision tree.
I will see what is that about.

however that big bug is no a regular shape, that is a scale compound object that I put there to test a different bug.
I will fix that because it should work, but that is no the bug that you were reposition, the bug you the bug you reported is failure when casting over a collision tree when the cylinder has a rotated local matrix.

this bug I s numerical error bug, because the box you see there is a huge object scaled 100 smaller on each dimension

In the demo try comment out the function that put that box in the scene so that we do not confuse different error
herei Is how

Code: Select all
// create physics scene
void ConvexCast (DemoEntityManager* const scene)
{
   scene->CreateSkyBox();

   // customize the scene after loading
   // set a user friction variable in the body for variable friction demos
   // later this will be done using LUA script
   //NewtonWorld* const world = scene->GetNewton();
   dMatrix offsetMatrix (GetIdentityMatrix());

//   CreateLevelMesh (scene, "flatPlane.ngd", 0);
//   CreateLevelMesh (scene, "playground.ngd", 0);

   StupidComplexOfConvexShapes* const stupidLevel = new StupidComplexOfConvexShapes (scene, 100);
   new dConvexCastManager (scene, stupidLevel);

// add a single compound Box test

// comment this line out so that we do not confuse different error
//AddSingleCompound(scene);

AddStaticMesh(scene);

   // place camera into position
   dMatrix camMatrix (GetIdentityMatrix());
   dQuaternion rot (camMatrix);
   dVector origin (-30.0f, 10.0f, 0.0f, 0.0f);
   scene->SetCameraMatrix(rot, origin);
}



mean time I will fix that bug and also check oy whet is going one when the matrix is rotated.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: convex cast problem

Postby hamsterexplosion » Sun Nov 03, 2013 6:17 pm

Julio Jerez wrote:Ithe bug you reported is failure when casting over a collision tree when the cylinder has a rotated local matrix

no, not the tree collision, there was no problems with it. i had problems when casting rotated cylinder to dynamic bodies
User avatar
hamsterexplosion
 
Posts: 20
Joined: Thu Jul 11, 2013 11:54 am
Location: ukraine

Re: convex cast problem

Postby hamsterexplosion » Sun Nov 03, 2013 6:33 pm

btw, that "ramp.off" object also causes cast fails sometimes at edges
User avatar
hamsterexplosion
 
Posts: 20
Joined: Thu Jul 11, 2013 11:54 am
Location: ukraine

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests

cron