Hello physics addicts,
I also tried to run the lib and some examples and it seems it’s still not working.
I added the attached lib to the Derivative folder and tried running the hello example in a textDAT
[code]from Box2D import (b2PolygonShape, b2World)
world = b2World() # default gravity is (0,-10) and doSleep is True
groundBody = world.CreateStaticBody(position=(0, -10), shapes=b2PolygonShape(box=(50, 10)))
Create a dynamic body at (0, 4)
body = world.CreateDynamicBody(position=(0, 4))
And add a box fixture onto it (with a nonzero density, so it will move)
box = body.CreatePolygonFixture(box=(1, 1), density=1, friction=0.3)
Prepare for simulation. Typically we use a time step of 1/60 of a second
(60Hz) and 6 velocity/2 position iterations. This provides a high quality
simulation in most game scenarios.
timeStep = 1.0 / 60
vel_iters, pos_iters = 6, 2
This is our little game loop.
for i in range(60):
# Instruct the world to perform a single step of simulation. It is
# generally best to keep the time step and iterations fixed.
world.Step(timeStep, vel_iters, pos_iters)
# Clear applied body forces. We didn't apply any forces, but you should
# know about this function.
world.ClearForces()
# Now print the position and angle of the body.
print(body.position, body.angle)
[/code]
I managed to have it working in the python standalone shell as well
but I get this same error in TD
File "/project1/text1", line 4, in <module>
File "C:/Program Files/Derivative/TouchDesigner088/bin/TouchInit.py", line 205, in tdcustomimport
r = previousimport(*args, **kw)
File "C:\Program Files\Derivative\TouchDesigner088\bin\lib\Box2D\__init__.py", line 20, in <module>
from .Box2D import *
File "C:/Program Files/Derivative/TouchDesigner088/bin/TouchInit.py", line 205, in tdcustomimport
r = previousimport(*args, **kw)
File "C:\Program Files\Derivative\TouchDesigner088\bin\lib\Box2D\Box2D.py", line 32, in <module>
_Box2D = swig_import_helper()
File "C:\Program Files\Derivative\TouchDesigner088\bin\lib\Box2D\Box2D.py", line 28, in swig_import_helper
_mod = imp.load_module('_Box2D', fp, pathname, description)
File "C:\Program Files\Derivative\TouchDesigner088\bin\lib\imp.py", line 183, in load_module
return load_dynamic(name, filename, file)
ImportError: DLL load failed: %1 is not a valid Win32 application.
What’s missing that would make it work ?
I’m using vvvv at the moment for a personal project using simple 2D physics, I would love to port it to TD
Thanks a lot !
Box2D.zip (426 KB)