Creating a revolute joint?
mlg556 opened this issue · 2 comments
mlg556 commented
Following the C++ API:
b2RevoluteJointDef jointDef;
b2RevoluteJoint* joint = (b2RevoluteJoint*)myWorld->CreateJoint(&jointDef);
I have tried:
jointDef := box2d.MakeB2RevoluteJointDef()
joint := (*box2d.B2RevoluteJoint)(world.CreateJoint(&jointDef))
which results in the error: cannot convert world.CreateJoint(&jointDef) (value of type box2d.B2JointInterface) to *box2d.B2RevoluteJoint
can you give an example on how to create a joint?
mlg556 commented
I have also tried:
jointDef := box2d.MakeB2RevoluteJointDef()
joint := box2d.MakeB2RevoluteJoint(&jointDef)
which results in a panic: B2Assert
in the second line:
panic: B2Assert
goroutine 35 [running]:
github.com/ByteArena/box2d.B2Assert(...)
/Users/USER/go/pkg/mod/github.com/!byte!arena/box2d@v1.0.2/CommonB2Settings.go:11
github.com/ByteArena/box2d.MakeB2Joint(0x41ed6c0, 0xc000164000, 0x0)
/Users/USER/go/pkg/mod/github.com/!byte!arena/box2d@v1.0.2/DynamicsB2Joint.go:366 +0x296
github.com/ByteArena/box2d.MakeB2RevoluteJoint(0xc000164000, 0x0)
/Users/USER/go/pkg/mod/github.com/!byte!arena/box2d@v1.0.2/DynamicsB2JointRevolute.go:156 +0x55