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

Bind functions into b2Joint, and make Joints inherited from b2Joint #91

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

haskasu
Copy link
Contributor

@haskasu haskasu commented Aug 20, 2018

in order to debugDraw joints in lfjs, we need to add GetAnchorA() and GetAnchorB() functions in all b2Joints
So what this pr does are:

  1. make all Joint classes (b2DistanceJoint for instance) extends from b2Joint
  2. reorder the classes in uglify.sh, to make sure all joint class load after b2Joint
  3. bind methords of all Joints classes
  4. add js variables to quick access b2Joint properties

arr[1] = force.y;
}
double b2Joint_GetReactionTorque(void* joint, double inv_dt) {
return ((b2Joint*)joint)->GetReactionTorque(inv_dt);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indent seems to be 4 spaces here and below, whereas its 2 elsewhere

/**@constructor*/
function b2DistanceJoint(def) {
b2Joint.call(this, def);
}
b2DistanceJoint.prototype = Object.create(b2Joint.prototype);
b2DistanceJoint.prototype.constructor = b2DistanceJoint;

b2DistanceJoint.prototype.SetLength = function(length) {
b2DistanceJointDef_SetLength(this.prt, length);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing, inconsistent indentation here.

@alexames
Copy link

Can you squash this down to a single commit?

Generally looks good, but I want to get at least one more pair of eyes on it before I approve it. One thing I did notice is that in some files the indentation is inconsistent. Some places use two spaces for indentation, some use 4. Can you fix these? I marked some of them, but check other files for inconsistencies too.

1. add b2Joint.GetType()
1. add b2Joint.GetAnchorA()
1. add b2Joint.GetAnchorB()
 - move bodyA/bodyB into b2Joint as source C does it.
 - add GetReactionForce()
 - add GetReactionTorque()
 - add IsActive()
 - add GetCollideConnected()

make up  b2DistanceJoint methods

make up b2FrictionJoint methods

make up b2GearJoint methods.

make up b2MtorJoint methods

make up b2MouseJoint methods

 make up b2PrismaticJoint methods

make up b2PulleyJoint methods

make up b2RevoluteJoint methods

make up b2RopeJoint methods

add limit_state enums

make up b2WeldJoint methods

make up b2WheelJoint methods

change indents to 2 spaces
@haskasu
Copy link
Contributor Author

haskasu commented Sep 12, 2018

I think i successfully squashed to one commit ( i am a git newbie)
And I've make indents to 2 spaces, so it should look better.

void b2Body_SetLinearDamping(void* body, double linearDamping);
double b2Body_GetLinearDamping(void* body);
void b2Body_SetAngularDamping(void* body, double angularDamping);
double b2Body_GetAngularDamping(void* body);
bool b2Body_IsAwake(void* body);
void b2Body_SetBullet(void* body, double flag);
bool b2Body_IsBullet(void* body);
void b2Body_SetSleepingAllowed(void* body, double flag);
bool b2Body_IsSleepingAllowed(void* body);
void b2Body_SetActive(void* body, double flag);
bool b2Body_IsActive(void* body);
bool boBody_IsFixedRotation(void* body);
@danbri
Copy link

danbri commented Feb 21, 2021

Hi @alexames @haskasu

I have been trying to build the latest codebase using current emscripten toolchain (on Chromebook, via emsdk, including "emsdk install fastcomp-clang-e1.38.31-64bit" since liquidfun docs ask for fastcomp). I was hoping for wasm rather than js, eventually, but initial challenge is to get anything built:

A naive attempt fails with

emcc: error: undefined exported symbol: "_b2GearJointDef_InitializeAndCreate" [-Wundefined] [-Werror]

Since googling for "_b2GearJointDef_InitializeAndCreate" finds exactly one hit - this PR - it seemed worth mentioning here.

@danbri
Copy link

danbri commented Feb 21, 2021

I should add that https://github.com/haskasu/liquidfun gives me the same emcc build error; as does liquidfun-1.1.0.zip. Despite the error, an "lf_core.wasm" (size 234940) does get produced.

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

Successfully merging this pull request may close these issues.

3 participants