Comments (4)
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.
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.
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.
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)
- b2Vec2 won't free HOT 2
- Unable to build latest on macOS Mojave with [email protected] HOT 5
- High Gravity jitter HOT 1
- missing runtime methods for allocating arrays HOT 4
- box2d.wasm.html test faild with [email protected] build HOT 2
- is there typescript declaration file (d.ts) for this project? HOT 2
- Box2d 2.4.0
- Box2D 2.4.0 HOT 8
- Node server side implementation
- How does this work with webpack? HOT 1
- May I ask why the calculation results are different on the ios and android platforms HOT 2
- vue how to use it
- vue hao to use it
- why is not show?
- why now show debugdraw
- could i have more simple demos about the box2djs οΌand where can i see the API about box2djs
- How to build? I want to build the debug version of javascript file
- Position not getting what is set
- Uncaught (in promise) cannot construct a b2Draw, no constructor in IDL
- Cannot SetTarget of b2MouseJoint
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from box2d.js.