Your idea of rendering a curve even though the joint is a line is excellent, I may well do that in conjunction with the "softness" property, which as far as I can tell allows the joint to stretch. Will try to come up with a "droop" curve for the rope if it's not being stretched...
Hello. Appreciate this isn't a Lua and C general help forum, but wondered if you could help point me in the right direction. How do I include things like this into my project? I'm a Mac user, so not sure if the makefile is relevant to me. Do I need to use a builder?
Thanks.
Edit: Tried it in Nova and it works perfectly. Thinking I need a builder for VS Code. I'll use Nova in the meantime. Thanks for sharing.
Edit 2: Is it possible to get the force of a collision? Or the velocity?
I am trying to use it in my project but I am a linux user, how can I add this to my vscode project? When I import to simulator allways says that playbox is not found.
Thanks so much
Check the Makefile in the example and main.c for how to add the API to the Lua runtime. Nova handles building this for you and I highly recommend it for Playdate dev.
I'm also trying to get this working with Nova, however I'm running into errors on building. I'm pretty new to developing on Mac, so not quite sure where my issue is. I downloaded the directory from GitHub, loaded it in Nova and tried to build with the Playdate extension, however I get this error. Do you have any ideas? I appreciate all the work you've done on porting this!
Task Terminated with exit code 1
/usr/local/bin/arm-none-eabi-gcc
detected_OS is "Darwin"
mkdir -p build
mkdir -p build/dep
mkdir -p `dirname build/extension/main.o`
/usr/local/bin/arm-none-eabi-gcc -g -c -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-sp-d16 -D__FPU_USED=1 -O2 -falign-functions=16 -fomit-frame-pointer -gdwarf-2 -Wall -Wno-unused -Wstrict-prototypes -Wno-unknown-pragmas -fverbose-asm -Wdouble-promotion -ffunction-sections -fdata-sections -Wa,-ahlms=build/main.lst -DTARGET_PLAYDATE=1 -DTARGET_EXTENSION=1 -MD -MP -MF build/dep/main.o.d -I . -I . -I /Users/ME/Developer/PlaydateSDK/C_API -I extension -I playbox2d extension/main.c -o build/extension/main.o
make: /usr/local/bin/arm-none-eabi-gcc: Bad CPU type in executable
make: *** [build/extension/main.o] Error 1
The file /Users/ME/Downloads/playbox2d-main/playboxdemo.pdx does not exist.
Task “Build” exited with a non-zero exit status: 1.
But I get this error when I open it with the simulator
11:28:19: Loading: OK
update failed: main.lua:58: attempt to index a nil value (global 'playbox')
stack traceback:
main.lua:58: in function 'setup'
main.lua:8: in function <main.lua:6>
Edit: I'm able to get it to run on the simulator on Linux, just not on the simulator on Windows.
Something is not setting up playbox correctly. Specifically, the registerPlaybox() method looks like it's never called because that is what makes Lua aware of the playbox global.
I didn't run into any problems related to 'registerPlaybox()' (just a datapoint)
(It's a wonder what some regular sleep and no interruptions can do - have been on vacation since Wednesday) - I finally had time to attempt setting up the Playdate SDK for mixed C/Lua builds on both an M1 Mac Mini and my regular Windows workstation, and have the playbox2d demo built, up and running on both (had to tweak the sources a bit to get Visual Studio 2019 happy, it didn't like 'unknown size' for a type of 'void*' or unsized array declarations): VS2019 tweaks .
This is neat stuff! I can't wait to build a minigame/easteregg with it.
Day after US Thanksgiving here (Black Friday), sipping a beverage and idling through the playbox2d source code - happily discovered that collision detection is in fact supported:
world:getNumberOfContacts(body1, body2)
...tested that in a minigame testbed and it works a treat.
While looking through the sources I was also wondering 'what's this Arbiter thing all about?' - and found a slide deck ('Arbiters' towards the end) that I share here in the hopes it might prove useful to folks using playbox2d: Fast and Simple Physics using Sequential Impulses
Happy holidays!
Edit: Really enjoying this... mini-game update using Playbox2d here.
Won't these commands be ported to the M processor? Or do they in fact just call into various tools that are already ported? Still, would be nice not having to install Rosetta.
We do have a tracking issue to get moved to a universal ARM compiler but that requires a lot of validation on our end so we haven't had time to do it just yet.