box2d
box2d copied to clipboard
Creating a revolute joint?
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?
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/[email protected]/CommonB2Settings.go:11
github.com/ByteArena/box2d.MakeB2Joint(0x41ed6c0, 0xc000164000, 0x0)
/Users/USER/go/pkg/mod/github.com/!byte!arena/[email protected]/DynamicsB2Joint.go:366 +0x296
github.com/ByteArena/box2d.MakeB2RevoluteJoint(0xc000164000, 0x0)
/Users/USER/go/pkg/mod/github.com/!byte!arena/[email protected]/DynamicsB2JointRevolute.go:156 +0x55
Hi @mlg556 (or anyone), could you get it worked ? I could instantiate. However, the motor is not revolving.