www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Bullet Physics in D

reply Jonathan Levi <catanscout gmail.com> writes:
I want to use the Bullet physics engine for a project of mine 
which is in D.  I have found many a bunch of different posts in 
the Forum (the most recent was in 2016).  The primary problem 
seemed to be dealing with the fact the Bullet is made in C++.  
(It has been 4 years, has D & C++ binding gotten easier now?)

Bullet now has a first-party C API (which they use for PyBullet 
(Python bindings for Bullet)).  It should then theoretically be 
easy to make bindings!

I would really like to see bindings for Bullet created.  And I 
will be putting effort to do it, but I know there are others in 
the D community who would far better at managing it than myself.

 BLM768  Dechcaudron  vuaru
Jan 30 2020
next sibling parent reply Ferhat =?UTF-8?B?S3VydHVsbXXFnw==?= <aferust gmail.com> writes:
On Thursday, 30 January 2020 at 18:52:36 UTC, Jonathan Levi wrote:
 I want to use the Bullet physics engine for a project of mine 
 which is in D.  I have found many a bunch of different posts in 
 the Forum (the most recent was in 2016).  The primary problem 
 seemed to be dealing with the fact the Bullet is made in C++.  
 (It has been 4 years, has D & C++ binding gotten easier now?)

 Bullet now has a first-party C API (which they use for PyBullet 
 (Python bindings for Bullet)).  It should then theoretically be 
 easy to make bindings!

 I would really like to see bindings for Bullet created.  And I 
 will be putting effort to do it, but I know there are others in 
 the D community who would far better at managing it than myself.

  BLM768  Dechcaudron  vuaru
You don't need a binding to start using it. You can easily call C functions from D as long as you provide a proper linkage.
Jan 30 2020
parent Ferhat =?UTF-8?B?S3VydHVsbXXFnw==?= <aferust gmail.com> writes:
On Thursday, 30 January 2020 at 19:40:24 UTC, Ferhat Kurtulmuş 
wrote:
 On Thursday, 30 January 2020 at 18:52:36 UTC, Jonathan Levi 
 wrote:
 [...]
You don't need a binding to start using it. You can easily call C functions from D as long as you provide a proper linkage.
Writing a binding is a good learning practice also. I was trying to call some opencv functions, and I ended up with an opencv binding.
Jan 30 2020
prev sibling parent reply bachmeier <no spam.net> writes:
On Thursday, 30 January 2020 at 18:52:36 UTC, Jonathan Levi wrote:
 I want to use the Bullet physics engine for a project of mine 
 which is in D.  I have found many a bunch of different posts in 
 the Forum (the most recent was in 2016).  The primary problem 
 seemed to be dealing with the fact the Bullet is made in C++.  
 (It has been 4 years, has D & C++ binding gotten easier now?)

 Bullet now has a first-party C API (which they use for PyBullet 
 (Python bindings for Bullet)).  It should then theoretically be 
 easy to make bindings!

 I would really like to see bindings for Bullet created.  And I 
 will be putting effort to do it, but I know there are others in 
 the D community who would far better at managing it than myself.

  BLM768  Dechcaudron  vuaru
Do you have a link to the C API documentation/examples? Using dpp, it should be nothing more than adding an #include statement at the top of your D file and calling the functions. Or use dstep to generate the bindings.
Jan 30 2020
parent reply Gregor =?UTF-8?B?TcO8Y2ts?= <gregormueckl gmx.de> writes:
On Thursday, 30 January 2020 at 20:53:39 UTC, bachmeier wrote:
 Do you have a link to the C API documentation/examples? Using 
 dpp, it should be nothing more than adding an #include 
 statement at the top of your D file and calling the functions. 
 Or use dstep to generate the bindings.
This piqued my interest, too, but I don't see any documentation. The only C wrapper that I found is part of the shared memory client/server example. Pybullet piggybacks on that (an example program including code from a separate example). At first glance, all of this looks pretty weird and I can't make out how stable, complete or efficient it actually is.
Jan 30 2020
parent reply Andrea Fontana <nospam example.com> writes:
On Friday, 31 January 2020 at 00:37:27 UTC, Gregor Mückl wrote:
 On Thursday, 30 January 2020 at 20:53:39 UTC, bachmeier wrote:
 Do you have a link to the C API documentation/examples? Using 
 dpp, it should be nothing more than adding an #include 
 statement at the top of your D file and calling the functions. 
 Or use dstep to generate the bindings.
This piqued my interest, too, but I don't see any documentation. The only C wrapper that I found is part of the shared memory client/server example. Pybullet piggybacks on that (an example program including code from a separate example). At first glance, all of this looks pretty weird and I can't make out how stable, complete or efficient it actually is.
https://github.com/bulletphysics/bullet3/blob/master/examples/pybullet/pybullet.c This sounds like a c binding
Jan 31 2020
parent reply Gregor =?UTF-8?B?TcO8Y2ts?= <gregormueckl gmx.de> writes:
On Friday, 31 January 2020 at 09:00:45 UTC, Andrea Fontana wrote:
 On Friday, 31 January 2020 at 00:37:27 UTC, Gregor Mückl wrote:
 This piqued my interest, too, but I don't see any 
 documentation. The only C wrapper that I found is part of the 
 shared memory client/server example. Pybullet piggybacks on 
 that (an example program including code from a separate 
 example). At first glance, all of this looks pretty weird and 
 I can't make out how stable, complete or efficient it actually 
 is.
https://github.com/bulletphysics/bullet3/blob/master/examples/pybullet/pybullet.c This sounds like a c binding
This is what I was referring to. The actual C wrapper layer is in the SharedMemory example code: https://github.com/bulletphysics/bullet3/blob/master/examples/SharedMemory/PhysicsClientC_API.h The file you linked is the python binding around that. Bullet currently consists of two nearly entirely independent implementations in src/. This C wrapper seems to wrap only the newer bullet3 implementation, which looks noticeably less complete to me.
Jan 31 2020
parent reply bachmeier <no spam.net> writes:
On Friday, 31 January 2020 at 10:02:24 UTC, Gregor Mückl wrote:
 On Friday, 31 January 2020 at 09:00:45 UTC, Andrea Fontana 
 wrote:
 On Friday, 31 January 2020 at 00:37:27 UTC, Gregor Mückl wrote:
 This piqued my interest, too, but I don't see any 
 documentation. The only C wrapper that I found is part of the 
 shared memory client/server example. Pybullet piggybacks on 
 that (an example program including code from a separate 
 example). At first glance, all of this looks pretty weird and 
 I can't make out how stable, complete or efficient it 
 actually is.
https://github.com/bulletphysics/bullet3/blob/master/examples/pybullet/pybullet.c This sounds like a c binding
This is what I was referring to. The actual C wrapper layer is in the SharedMemory example code: https://github.com/bulletphysics/bullet3/blob/master/examples/SharedMemory/PhysicsClientC_API.h The file you linked is the python binding around that. Bullet currently consists of two nearly entirely independent implementations in src/. This C wrapper seems to wrap only the newer bullet3 implementation, which looks noticeably less complete to me.
It must have started out as a Java implementation. Just look at the verbosity of the names: B3_SHARED_API void b3CalculateInverseKinematicsAddTargetPositionWithOrientation(b3Share MemoryCommandHandle commandHandle, int endEffectorLinkIndex, const double targetPosition[/*3*/], const double targetOrientation[/*4*/]);
Jan 31 2020
parent JN <666total wp.pl> writes:
On Friday, 31 January 2020 at 14:01:22 UTC, bachmeier wrote:
 It must have started out as a Java implementation. Just look at 
 the verbosity of the names:

 B3_SHARED_API void 
 b3CalculateInverseKinematicsAddTargetPositionWithOrientation(b3Share
MemoryCommandHandle commandHandle, int endEffectorLinkIndex, const double
targetPosition[/*3*/], const double targetOrientation[/*4*/]);
This doesn't strike me as very verbose. I actually like verbose names because they explain what the method does well. And in a proper ide you can type CIKAT, press ctrl+space and the entire name will get autocompleted.
Feb 03 2020