Getting started with Newton 4

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Getting started with Newton 4

Postby JoshKlint » Sat May 28, 2022 6:40 am

I have built the library with cmake and visual studio. I am including the library and ndNewton.h. Is there still a C API?
JoshKlint
 
Posts: 163
Joined: Sun Dec 10, 2017 8:03 pm

Re: Getting started with Newton 4

Postby Julio Jerez » Sat May 28, 2022 6:50 am

No c api.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Getting started with Newton 4

Postby JoshKlint » Sat May 28, 2022 7:04 am

Okay :lol:
JoshKlint
 
Posts: 163
Joined: Sun Dec 10, 2017 8:03 pm

Re: Getting started with Newton 4

Postby JoeJ » Sun Jul 24, 2022 2:23 am

I expected some issues from not having the C API, and what i'm currently stuck at is maybe a good example.

I have a small sim running, and now i want to visualize the bodies shapes.
Previously i did this using my own functions like DrawBox or DrawSphere. But they don't cover all shapes Newton has, they lack chamfered variants, etc.
So i'd rather reuse Newtons visualization functionality, which isn't expected to be easy because it probably depends on a lot of demo / sandbox functionality, which i do not want to include. However - this was my experience so far:

Looking at ndDemoEntityManager::DrawDebugShapes(), but from there i can not find the code which actually generates triangles for such primitives.
I try to find code by IDE features like right clicking on some class name, then 'go to definition / declaration'.
But this always brings me to some base class which has almost no functionality, and idk how to get to the derived classes which have the functionality, but remain unknown to me.
Because Newton uses inheritance so heavily, but personally i use it very rarely, my usual practices to navigate code completely fail.
Any advice on code navigation practices is welcome. I feel like i'm missing some basic things i've just never learned or missed.

After failing on this i just remembered there was functionality to iterate faces of collision shapes.
Probably this does not work for primitive shapes like spheres, but regardless - i realize it is now hard to find such functionality, even i know it must be there.
This was no problem with the C API, because i only had to scroll this single file to find all functionality there is.
But what should i do now? Where should i start my search, and how can i avoid the same issue of getting stuck at generalized base classes again?
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: Getting started with Newton 4

Postby Dave Gravel » Sun Jul 24, 2022 3:34 pm

I think you only need to implement a ndShapeDebugNotify class.
The debugNotify give you a DrawPolygon function.
You can process the debug shape triangles in this function, In the same way used with old newton version.
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://orionx3d.sytes.net
https://www.facebook.com/dave.gravel1
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 800
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: Getting started with Newton 4

Postby JoeJ » Mon Jul 25, 2022 3:42 am

Now, that was easy :D
Thanks!
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 46 guests

cron