Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a revolute joint? #31

Open
mlg556 opened this issue Oct 22, 2020 · 2 comments
Open

Creating a revolute joint? #31

mlg556 opened this issue Oct 22, 2020 · 2 comments

Comments

@mlg556
Copy link

mlg556 commented Oct 22, 2020

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
Copy link
Author

mlg556 commented Oct 22, 2020

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

@xansrnitu
Copy link

xansrnitu commented Aug 16, 2023

Hi @mlg556 (or anyone), could you get it worked ? I could instantiate. However, the motor is not revolving.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants