chipmunkcore
is a low-level wrapper around the Chipmunk2d rigid body physics simulation library.
chipmunkcore
is just the simulator. To actually render the positions of bodies in the simulation you’ll need to use ggplot2, cairocore or something else
Read the online documentation for chipmunkcore
here
Regular users will probably want to use the higher level wrapper chipmunkbasic
chipmunkcore
You’ll need to install the Chipmunk2d library on your system.
Click to show instructions for macOS
I only know how to do this on macOS where you can do
You may also need to update/install your xcode tools - see here
Click to show instructions for ubuntu - method 1
Thanks to tylermorganwall for the following instructions
I spun up an RStudio AMI on AWS to try and install chipmunkcore and was successful. Here’s my instructions:
First we need to install cmake if it’s not already installed, along with some other pre-reqs:
Now we install the Chipmunk2D library:
And finally, symlink the header files and shared object library so R can find it during installation. The path /home/rstudio/Chipmunk2D
will be different depending on where you installed the Chipmunk2D folder.
Click to show instructions for Linux (verified on Ubuntu 18.04 LTS) - Method 2
Thanks to Henrik Bengtsson for the following instructions.
These instructions should work on most Linux systems.
Following the instructions on https://github.com/slembcke/Chipmunk2D:
Before we can install the software, we need to build it:
curl -L -O https://github.com/slembcke/Chipmunk2D/archive/Chipmunk-7.0.3.tar.gz
tar xf Chipmunk-7.0.3.tar.gz
cd Chipmunk2D-Chipmunk-7.0.3
cmake .
make
Now we can install it. If we have admin rights, we can install it system-wide as:
You’re done!
If we only have non-privileged user rights on the system, then sudo make install
will give an error. Instead, we have to install to a folder where we have write permissions. This can be done by specifying the CMake-specific environment variable DESTDIR
:
For other software to be able to compile toward Chipmunk2D, we need to update a few standard environment variable:
export CPATH="$HOME/software/Chipmunk-7.0.3/usr/local/include:${CPATH}"
export LIBRARY_PATH="$HOME/software/Chipmunk-7.0.3/usr/local/lib:${LIBRARY_PATH}"
If you got this far, you should be able to install chipmunkcore in R:
# install.package('remotes') remotes::install_github('coolbutuseless/chipmunkcore')
Now, in order for compiled software to find the Chipmunk2D library files when running, we also need to add:
If you got, you will be able to use the chipmunkcore package:
> library(chipmunkcore) >
If you get:
> library(chipmunkcore)
Error: package or namespace load failed for 'chipmunkcore' in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/home/alice/R/x86_64-pc-linux-gnu-library/4.0-custom/chipmunkcore/libs/chipmunkcore.so':
libchipmunk.so.7: cannot open shared object file: No such file or directory
then LD_LIBRARY_PATH
is either not set or set incorrect.
Tips: Append the above export ...
lines to your ~/.bashrc
so set them automatically.
No windows instructions available for C library installation - Can you help?
If you know how to install the Chipmunk2d C library on Windows, and subsequently compile this package, please let me know by filing an issue, or pinging me on twitter. Thanks!
After installing the Chipmunk2d C library, you can install this package from GitHub with:
# install.package('remotes') remotes::install_github('coolbutuseless/chipmunkcore')
For full code, see the vignette in chipmunkbasic