Giter Site home page Giter Site logo

Comments (4)

kripken avatar kripken commented on July 21, 2024

You can "trick" the old bindings generator into generating code for something by making it a class with a constructor. This makes it be bound, but I did not test beyond seeing it shows up as Box2D.b2MassData:

class b2MassData
{
public:
  b2MassData() {}

    /// The mass of the shape, usually in kilograms.
    float32 mass;

    /// The position of the shape's centroid relative to the shape's origin.
    b2Vec2 center;

    /// The rotational inertia of the shape about the local origin.
    float32 I;
};

from box2d.js.

Joncom avatar Joncom commented on July 21, 2024

Yes, that's correct. Do you suggest this "trick" as an official fix? Although it may work in this instance, it does not seem viable for other similar cases. For example, b2Manifold is also unbound, but it will not work here. It seems that it fails because the struct in this case contains an enum.

Not sure why it makes a difference but it does...

struct b2Manifold
{
    b2Manifold() {}

    enum Type
    {
        e_circles,
        e_faceA,
        e_faceB
    };

    b2ManifoldPoint points[b2_maxManifoldPoints];   ///< the points of contact
    b2Vec2 localNormal;                             ///< not use for Type::e_points
    b2Vec2 localPoint;                              ///< usage depends on manifold type
    Type type;
    int32 pointCount;                               ///< the number of manifold points
};

Sorry for not providing an exact error message. I'm simply recalling from memory the events I experienced with your port a couple weeks ago.

from box2d.js.

jagenjo avatar jagenjo commented on July 21, 2024

Same here, I wanted to change the mass of an object during the execution but I cant see how is it possible if b2MassData is not visible.

from box2d.js.

kripken avatar kripken commented on July 21, 2024

It could be an official fix, yeah ;) the problem is the old bindings
generator needs hacks like this to work, that's why moving to embind is a
good idea.

An enum should not matter, but perhaps I forgot yet another weirdness in
the old bindings generator. If you move the enum of out if, does it work?
My first guess is that the issue is either that it is a struct and not a
class, or that points' length depends on a variable (making it a C constant
might help).

On Wed, Jul 17, 2013 at 8:57 AM, jagenjo [email protected] wrote:

Same here, I wanted to change the mass of an object during the execution
but I cant see how is it possible if b2MassData is not visible.

β€”
Reply to this email directly or view it on GitHubhttps://github.com//issues/38#issuecomment-21123335
.

from box2d.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.