flyover / box2d.ts Goto Github PK
View Code? Open in Web Editor NEWA TypeScript port of Box2D
Home Page: https://flyover.github.io/box2d.ts/testbed
License: MIT License
A TypeScript port of Box2D
Home Page: https://flyover.github.io/box2d.ts/testbed
License: MIT License
When I run tsc
, I got many errors:
Controllers/b2Controller.ts(44,31): error TS2304: Cannot find name 'Set'.
Controllers/b2Controller.ts(44,31): error TS4031: Public property 'm_bodyList' of exported class has or is using private name 'Set'.
Controllers/b2Controller.ts(44,59): error TS2304: Cannot find name 'Set'.
Controllers/b2Controller.ts(66,25): error TS2304: Cannot find name 'Set'.
Controllers/b2Controller.ts(66,25): error TS4055: Return type of public method from exported class has or is using private name 'Set'.
Dynamics/b2Body.ts(185,34): error TS2304: Cannot find name 'Set'.
Dynamics/b2Body.ts(185,34): error TS4031: Public property 'm_fixtureList' of exported class has or is using private name 'Set'.
Dynamics/b2Body.ts(185,55): error TS2304: Cannot find name 'Set'.
Dynamics/b2Body.ts(187,32): error TS2304: Cannot find name 'Set'.
Dynamics/b2Body.ts(187,32): error TS4031: Public property 'm_jointList' of exported class has or is using private name 'Set'.
Dynamics/b2Body.ts(187,55): error TS2304: Cannot find name 'Set'.
Dynamics/b2Body.ts(188,34): error TS2304: Cannot find name 'Set'.
Dynamics/b2Body.ts(188,34): error TS4031: Public property 'm_contactList' of exported class has or is using private name 'Set'.
Dynamics/b2Body.ts(188,59): error TS2304: Cannot find name 'Set'.
Dynamics/b2Body.ts(206,37): error TS2304: Cannot find name 'Set'.
Dynamics/b2Body.ts(206,37): error TS4031: Public property 'm_controllerList' of exported class has or is using private name 'Set'.
Dynamics/b2Body.ts(206,65): error TS2304: Cannot find name 'Set'.
Dynamics/b2Body.ts(988,28): error TS2304: Cannot find name 'Set'.
Dynamics/b2Body.ts(988,28): error TS4055: Return type of public method from exported class has or is using private name 'Set'.
Dynamics/b2Body.ts(993,26): error TS2304: Cannot find name 'Set'.
Dynamics/b2Body.ts(993,26): error TS4055: Return type of public method from exported class has or is using private name 'Set'.
Dynamics/b2Body.ts(1000,28): error TS2304: Cannot find name 'Set'.
Dynamics/b2Body.ts(1000,28): error TS4055: Return type of public method from exported class has or is using private name 'Set'.
Dynamics/b2Body.ts(1117,31): error TS2304: Cannot find name 'Set'.
Dynamics/b2Body.ts(1117,31): error TS4055: Return type of public method from exported class has or is using private name 'Set'.
Dynamics/b2ContactManager.ts(31,34): error TS2304: Cannot find name 'Set'.
Dynamics/b2ContactManager.ts(31,34): error TS4031: Public property 'm_contactList' of exported class has or is using private name 'Set'.
Dynamics/b2ContactManager.ts(31,55): error TS2304: Cannot find name 'Set'.
Dynamics/b2World.ts(69,31): error TS2304: Cannot find name 'Set'.
Dynamics/b2World.ts(69,31): error TS4031: Public property 'm_bodyList' of exported class has or is using private name 'Set'.
Dynamics/b2World.ts(69,49): error TS2304: Cannot find name 'Set'.
Dynamics/b2World.ts(70,32): error TS2304: Cannot find name 'Set'.
Dynamics/b2World.ts(70,32): error TS4031: Public property 'm_jointList' of exported class has or is using private name 'Set'.
Dynamics/b2World.ts(70,51): error TS2304: Cannot find name 'Set'.
Dynamics/b2World.ts(73,41): error TS2304: Cannot find name 'Set'.
Dynamics/b2World.ts(73,41): error TS4031: Public property 'm_particleSystemList' of exported class has or is using private name 'Set'.
Dynamics/b2World.ts(73,69): error TS2304: Cannot find name 'Set'.
Dynamics/b2World.ts(100,37): error TS2304: Cannot find name 'Set'.
Dynamics/b2World.ts(100,37): error TS4031: Public property 'm_controllerList' of exported class has or is using private name 'Set'.
Dynamics/b2World.ts(100,61): error TS2304: Cannot find name 'Set'.
Dynamics/b2World.ts(740,25): error TS2304: Cannot find name 'Set'.
Dynamics/b2World.ts(740,25): error TS4055: Return type of public method from exported class has or is using private name 'Set'.
Dynamics/b2World.ts(747,26): error TS2304: Cannot find name 'Set'.
Dynamics/b2World.ts(747,26): error TS4055: Return type of public method from exported class has or is using private name 'Set'.
Dynamics/b2World.ts(752,35): error TS2304: Cannot find name 'Set'.
Dynamics/b2World.ts(752,35): error TS4055: Return type of public method from exported class has or is using private name 'Set'.
Dynamics/b2World.ts(762,28): error TS2304: Cannot find name 'Set'.
Dynamics/b2World.ts(762,28): error TS4055: Return type of public method from exported class has or is using private name 'Set'.
Particle/b2ParticleSystem.ts(644,37): error TS2304: Cannot find name 'Set'.
Particle/b2ParticleSystem.ts(1031,34): error TS2304: Cannot find name 'Set'.
Particle/b2ParticleSystem.ts(1031,34): error TS4055: Return type of public method from exported class has or is using private name 'Set'.
I mean the difference about
features
bugs
performance
And in the future , will you update this project only (give up box2d.js) ?
thanks.
sleeping bodies wake up when their bounding box collides with another fixture's bounding box, rather than on the actual fixture shapes colliding - is this intentional? (it's not consistent with the behaviour of the flash version of box2d I am porting a game from)
today I just pulled the newest code from commit 'a65d936', and used the benchmark made by @finscn before http://fatidol.com/phy-benchmark/box2d-ts-test.html to test the performance.
the result is, the FPS drops to 20+ fps again.
also I have recorded 2 profiles to analyze the difference, I found that the new version made a big GC in the b2WorldManifold::Initialize
function:
TS4073: Parameter 'proxy' of public method from exported class has or is using private name 'b2DistanceProxy'.
Also having a version tag would be nice
Collision/Shapes/b2Shape.ts(19,31): error TS6133: 'XY' is declared but its value is never read.
Common/b2Draw.ts(19,10): error TS6133: 'b2Vec2' is declared but its value is never read.
Dynamics/b2Fixture.ts(20,31): error TS6133: 'XY' is declared but its value is never read.
I'm working on loading up the physics data from JSON. I noticed that both position
and linearVelocity
are defined as readonly in b2BodyDef
. Is there a reason for this? It seems odd, since in b2Body
it does set the value based on the b2BodyDef
values for position
and linearVelocity
, respectively. This more or less makes it effectively the default values.
Or am I missing something?
Last code update adds many variables as readonly 1a109d9#diff-7bf07a23ea2bae669d941930fde7633eR78
I think it's wrong. There should be a way to set the gravity (and others).
This would be very handy to track how many entities of each type still exist in the world
babel typescript does not support "const enum" and "namespace"
removing const from enum and also
refactoring the names in the namespace areas or moving them to their own module is needed to make it compatible.
qA & qB have never been used.
This isn't really a "bug". I was curious the best way to add this to a project. I'm currently getting starting with Typescript and webpack.
I have a rough prototype working where I simply added the script (box2d.umd.js) to my index.html file.
However, as there is no declaration file, it seems like it would be better off directly adding the source into my project? I notice all the export
s are in the Box2D.ts file. Whereas within Typescript I think you can include a directory by using an index.ts file.
Is there a recommended way to add into a project?
b2WheelJoint
the js files compiled from ts files are as same as dist/build files
.
In most open source projects , they won't commit dist/build files
to git.
And they will tell users how to build/compile the project.
example:
export class b2Mat22 {
public static AbsM(M: b2Mat22, out: b2Mat22): b2Mat22 { return b2AbsM(M, out); }
}
function b2AbsM(M: b2Mat22, out: b2Mat22): b2Mat22 {
const M_ex: b2Vec2 = M.ex, M_ey: b2Vec2 = M.ey;
out.ex.x = b2Abs(M_ex.x);
out.ex.y = b2Abs(M_ex.y);
out.ey.x = b2Abs(M_ey.x);
out.ey.y = b2Abs(M_ey.y);
return out;
}
Why don't you use :
export class b2Mat22 {
public static AbsM(M: b2Mat22, out: b2Mat22): b2Mat22 {
const M_ex: b2Vec2 = M.ex, M_ey: b2Vec2 = M.ey;
out.ex.x = b2Abs(M_ex.x);
out.ex.y = b2Abs(M_ex.y);
out.ey.x = b2Abs(M_ey.x);
out.ey.y = b2Abs(M_ey.y);
return out;
}
}
const b2AbsM = b2Mat22.AbsM;
When use es5 , user could use the dist js file in browser more easily.
Share my tsconfig.json
{
"compilerOptions": {
"target": "es5",
"module": "system",
"strict": true,
"strictNullChecks": false,
"inlineSourceMap": false,
"preserveConstEnums": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noImplicitUseStrict": false,
"noUnusedLocals": true,
"noUnusedParameters": false,
"removeComments": true,
"sourceMap": true,
"inlineSources": false,
"declaration": true,
"outFile": "../../dist/box2d-ts.js"
},
"include": [
"**/*.ts"
]
}
user could use box2d-ts.js
with system-production.js
in browser (and mobile browser) directly.
Hi, this question is about the same game I was talking about in #46
TL;DR (#46)
a top-down online game, rectangle-shaped sensor body around the player used to register objects in the world that shoud be sent to that player.
I faced the following problem: When the screen stops intersecting with a coin (and moves far away from it), sometimes the contact object is still there, it is still active and still thinks that it is touching.
Screen is a static body with a box shaped sensor. This body is moved to the player position on every tick.
A coin is a sleeping dynamic body with a circle shape.
What can cause this?
If you configure travis to run on this project I can add a new pull request to make a test build for each new PR.
all things are reversed up and down in Phaser3.....
the BODY's are exported from RUBE editor (https://www.iforce2d.net/rube/)
how to solve this problem?
Tell me please.
How can I implement and add DebugDraw through the abstract class b2Draw?
Hi, I am making a top-down view multiplayer game and I have a lot of objects on my map. The map is bigger than the player's screen, so one player can only see a part of a map.
When I am sending updates to the player I want to send him only the objects he can see to prevent him from cheating by zooming out. The most convenient solution that I found was to create a screen-sized sensor shape around the player. When this sensor begins a contact with an object, this means the player can see it and I can send it to the client. When the contact ends this means that the object disappeared from the player's screen and should be removed from the client's state.
This was a perfect solution, which saved me from storing arrays of everything a player can see and compare it with the new one on every tick to find what was added/removed from the screen. But, unfortunately player field of view can change over time. Shapes can't be updated in box2d. This means i have to delete an old screen shape and create a new one. When this happens, every contact with this shape is deleted and created again. Is there a solution for this case? Bodies involved in this contact didn't change, only their shapes did. What i want here is to track contacts by bodies not by shapes. I don't need any normals or something, only a boolean are they still touching or not.
Hello,
I figure out that even if this project is open source, you didn't put any license. Also as there is already many contributors it's already a problem.
Contributors have rights on license choice. So I recommend you to add one ASAP.
Notice that I'm in favor of MIT :).
@finscn also need to give his though on this
if Contributions
is in the top level.
The module name of Box2d will be Box2D/Box2D/Box2D
in system
( System.register("Box2D/Box2D/Box2D" ,..... )
It should be Box2D
One is box2d.ts/Build
Another one is box2d.ts/Box2D/Build
And the dist
dir should be box2d.ts/dist
, I think
this does not exist on PC, our environment is a special one, if you use Chian shap to make a wall, and when a dynamic box hits it, the box will 'bounce' back once.
in my code:
gravity: 9.8
box's linear velocity on horizontal is set to 4
road: whatever line shape or chain shap
others are all default value
here is the test video:
https://jc-space.com/test/v.mp4
as you can see, when the box hits the wall, it will be 'dragged' back (from x: 7.6 to 6.8) , and then move forward again (because I set linearvelocity in a loop), then back again, then loop again...
because this does not exist on PC and I'm not familiar with the principle of physics engine, so I have no idea at all what can cause this problem, float precision?? please help to analyze, thanks so much! this is really critical for us!
after compilation in VS code I get 2 thousand warnings (typescript 2.4.2)
Please, help me.
ts/Box2D/Particle/b2ParticleSystem.ts[3760, 15]: expected variable-declaration: 'vb' to have a typedef
ts/Box2D/Particle/b2ParticleSystem.ts[3766, 14]: expected variable-declaration: 'd' to have a typedef
ts/Box2D/Particle/b2ParticleSystem.ts[4763, 3]: The class method 'GetNext' must be marked either 'private', 'public', or 'protected'
ts/Box2D/Particle/b2ParticleSystem.ts[4784, 3]: The class property 'list' must be marked either 'private', 'public', or 'protected'
ts/Box2D/Particle/b2ParticleSystem.ts[4788, 3]: The class property 'next' must be marked either 'private', 'public', or 'protected'
ts/Box2D/Particle/b2ParticleSystem.ts[4793, 3]: The class property 'count' must be marked either 'private', 'public', or 'protected'
ts/Box2D/Particle/b2ParticleSystem.ts[4797, 3]: The class property 'index' must be marked either 'private', 'public', or 'protected'
ts/Box2D/Dynamics/Joints/b2MotorJoint.ts[108, 27]: expected call-signature: 'GetAngularOffset' to have a typedef
ts/Box2D/Dynamics/Joints/b2MotorJoint.ts[117, 22]: expected call-signature: 'GetMaxForce' to have a typedef
ts/Box2D/Dynamics/Joints/b2MotorJoint.ts[126, 23]: expected call-signature: 'GetMaxTorque' to have a typedef
ts/Box2D/Dynamics/Joints/b2MotorJoint.ts[219, 52]: expected member-variable-declaration: 'SolveVelocityConstraints_s_Cdot_v2' to have a typedef
ts/Box2D/Dynamics/Joints/b2MotorJoint.ts[220, 55]: expected member-variable-declaration: 'SolveVelocityConstraints_s_impulse_v2' to have a typedef
ts/Box2D/Dynamics/Joints/b2PulleyJoint.ts[395, 9]: " should be '
ts/Box2D/Dynamics/Joints/b2PulleyJoint.ts[396, 9]: " should be '
ts/Box2D/Dynamics/Joints/b2PulleyJoint.ts[397, 9]: " should be '
ts/Box2D/Dynamics/Joints/b2PulleyJoint.ts[398, 9]: " should be '
How much of box2d is ported and how much is left to do? Is there a todo list or maybe stubs in the code? It would be really nice to have a todo list, to be able to continue working on the project and to compare to other ports (there are already too many, of varying completeness and quality).
Really like what you have done this far. Is this a manual port? Maybe semi-automatic?
RayCast(output: b2RayCastOutput, input: b2RayCastInput, childIndex: number): boolean
What is the last parameter childIndex
? thanks.
Hello!
I'm getting build errors when I go to use box2d.ts in an Ionic project of mine. I've installed @flyover/box2d.ts via NPM.
The build errors I get don't seem to match the code I'm examining, and there are probably a hundred or more of them.
I'm aware there aren't this many errors in the library - there are none when I clone and build testbed on its own - but do you have any advice? I haven't seen this when using any other dependencies, so I'm stumped!
Thanks
Could someone publish a new npm package from the current version. The current npm package appears to be broken since when I try to compile my project that uses box2d.ts npm package I get a type error in b2ParticleSystem.ts in function std_lower_bound<A, B>(array: A[], first: number, last: number, val: B, cmp: (a: A, b: B) => boolean = default_compare)
where the error is probably caused because default_compare cannot be assigned to type (a:A, b: B) => boolean
since it is of type <T> (a: T, b: T) => boolean
. In the current version this seems to be fixed.
Thanks in advance.
as title said.
There are some errors :
Collision/b2BroadPhase.ts(111,16): error TS1251: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Class definitions are automatically in strict mode.
Collision/b2DynamicTree.ts(655,9): error TS6133: 'freeCount' is declared but its value is never read.
Dynamics/b2Body.ts(308,9): error TS6133: 'found' is declared but its value is never read.
Particle/b2ParticleSystem.ts(4527,9): error TS6133: 'discarded' is declared but its value is never read.
// #if B2_ENABLE_PARTICLE
is there some options in Rollup or somewhere to make this take effect?
for example defines: { B2_ENABLE_PARTICLE: false }
then the code in this section will be ignored when compiling?
thanks.
In the original liquidfun emscripten port from google, the buffers (such as GetPositionBuffer(), GetColorBuffer() etc.) are returned as flattened arrays of sequential data so it can be efficiently fed to a shader. (ie. positionBuffer[0] is X of the first particle, positionBuffer[1] is Y of the first particle)
In your port (which is fantastic, btw) you return arrays of objects with .x and .y properties instead.
Is there a reason you chose to make this change? Do you know if there is a performance hit / benefit?
@flyover , Hi ,
Do you have a plane to Change the name of API , then provide a JavaScript-friendly API ?
example:
box2d.b2BodyDef --> Box2d.bodyDef
world.CreateBody --> world.createBody
b2BodyType.b2_dynamicBody --> bodyType.dynamicBody
...
the things https://github.com/shakiba/planck.js do :
b2
prefix is dropped from class names, for example b2World
is now available as planck.World
.{}
).World#on(eventName, listenerFn)
and World#off(eventName, listenerFn)
are added to add and remove event listeners. Currently supported events are:
'begin-contact'
'end-contact'
'pre-solve'
'post-solve'
'joint-removed'
'fixture-removed'
I create a demo 'Tumbler' for testing performance .
And I found a strange thing.
When I use kinematic body
to the Tumbler outbox , the performance is bad.
http://fatidol.com/phy-benchmark/box2d-ts-test.html?type=kinematic
(40 FPS on my macbook)
When I use dynamic body + revolute joint
to the Tumbler outbox , the performance is better.
http://fatidol.com/phy-benchmark/box2d-ts-test.html
(60 FPS on my macbook)
This result puzzles me :
When & How should I use kinematic ?
I pull & build the last version of box2d.ts
and run my performance test again.
the fps is from 60fps to 30FPS
Gitter is a nice place for open source projects. Chatting may avoid us to create issues and can be productive. It may also allow people to know better each other. What do you think about dropping a link to a gitter chat?
Errors are emitted as below on typescript version 3.1.3
node_modules/box2d.ts/Box2D/Particle/b2ParticleSystem.ts(102,81): error TS2322: Type '<T>(a: T, b: T) => boolean' is not assignable to type '(a: A, b: B) => boolean'.
Types of parameters 'b' and 'b' are incompatible.
Type 'B' is not assignable to type 'A'.
node_modules/box2d.ts/Box2D/Particle/b2ParticleSystem.ts(118,81): error TS2322: Type '<T>(a: T, b: T) => boolean' is not assignable to type '(a: A, b: B) => boolean'.
Types of parameters 'b' and 'b' are incompatible.
Type 'B' is not assignable to type 'A'.
box2d.ts/Box2D/Dynamics/b2World.ts
Line 1661 in 99a83dd
isn't this step.positionIterations;
?
Hello,
I have encountered a strange bug. When I apply a small force (that causes acceleration lower than 0.02) to a dynamic body, instead of linear acceleration it periodically accelerates for a while and than the velocity gets reset back to zero:
Mass: 0.9176
Force: Vector { x: 0.001, y: 0 }
Current velocity: Vector { x: 0, y: 0 }
Current velocity: Vector { x: 0.000021795989537925027, y: 0 }
Current velocity: Vector { x: 0.000043591979075850053, y: 0 }
Current velocity: Vector { x: 0.00006538796861377507, y: 0 }
Current velocity: Vector { x: 0.00008718395815170011, y: 0 }
Current velocity: Vector { x: 0.00010897994768962514, y: 0 }
Current velocity: Vector { x: 0.00013077593722755017, y: 0 }
Current velocity: Vector { x: 0.0001525719267654752, y: 0 }
Current velocity: Vector { x: 0.00017436791630340024, y: 0 }
Current velocity: Vector { x: 0.00019616390584132527, y: 0 }
Current velocity: Vector { x: 0.0002179598953792503, y: 0 }
Current velocity: Vector { x: 0.00023975588491717534, y: 0 }
Current velocity: Vector { x: 0.00026155187445510035, y: 0 }
Current velocity: Vector { x: 0.0002833478639930254, y: 0 }
Current velocity: Vector { x: 0.0003051438535309504, y: 0 }
Current velocity: Vector { x: 0.00032693984306887545, y: 0 }
Current velocity: Vector { x: 0.0003487358326068005, y: 0 }
Current velocity: Vector { x: 0.0003705318221447255, y: 0 }
Current velocity: Vector { x: 0.00039232781168265055, y: 0 }
Current velocity: Vector { x: 0.0004141238012205756, y: 0 }
Current velocity: Vector { x: 0.0004359197907585006, y: 0 }
Current velocity: Vector { x: 0.00045771578029642565, y: 0 }
Current velocity: Vector { x: 0.0004795117698343507, y: 0 }
Current velocity: Vector { x: 0.0005013077593722757, y: 0 }
Current velocity: Vector { x: 0.0005231037489102007, y: 0 }
Current velocity: Vector { x: 0, y: 0 }
Current velocity: Vector { x: 0.000021795989537925027, y: 0 }
Current velocity: Vector { x: 0.000043591979075850053, y: 0 }
Current velocity: Vector { x: 0.00006538796861377507, y: 0 }
Current velocity: Vector { x: 0.00008718395815170011, y: 0 }
Current velocity: Vector { x: 0.00010897994768962514, y: 0 }
Current velocity: Vector { x: 0.00013077593722755017, y: 0 }
Current velocity: Vector { x: 0.0001525719267654752, y: 0 }
Current velocity: Vector { x: 0.00017436791630340024, y: 0 }
Current velocity: Vector { x: 0.00019616390584132527, y: 0 }
Current velocity: Vector { x: 0.0002179598953792503, y: 0 }
Current velocity: Vector { x: 0.00023975588491717534, y: 0 }
Current velocity: Vector { x: 0.00026155187445510035, y: 0 }
Current velocity: Vector { x: 0.0002833478639930254, y: 0 }
Current velocity: Vector { x: 0.0003051438535309504, y: 0 }
Current velocity: Vector { x: 0.00032693984306887545, y: 0 }
Current velocity: Vector { x: 0.0003487358326068005, y: 0 }
Current velocity: Vector { x: 0.0003705318221447255, y: 0 }
Current velocity: Vector { x: 0.00039232781168265055, y: 0 }
Current velocity: Vector { x: 0.0004141238012205756, y: 0 }
Current velocity: Vector { x: 0.0004359197907585006, y: 0 }
Current velocity: Vector { x: 0.00045771578029642565, y: 0 }
Current velocity: Vector { x: 0.0004795117698343507, y: 0 }
Current velocity: Vector { x: 0.0005013077593722757, y: 0 }
Current velocity: Vector { x: 0.0005231037489102007, y: 0 }
Current velocity: Vector { x: 0, y: 0 }
Current velocity: Vector { x: 0.000021795989537925027, y: 0 }
Current velocity: Vector { x: 0.000043591979075850053, y: 0 }
Current velocity: Vector { x: 0.00006538796861377507, y: 0 }
Current velocity: Vector { x: 0.00008718395815170011, y: 0 }
Current velocity: Vector { x: 0.00010897994768962514, y: 0 }
Current velocity: Vector { x: 0.00013077593722755017, y: 0 }
Current velocity: Vector { x: 0.0001525719267654752, y: 0 }
Current velocity: Vector { x: 0.00017436791630340024, y: 0 }
Current velocity: Vector { x: 0.00019616390584132527, y: 0 }
Current velocity: Vector { x: 0.0002179598953792503, y: 0 }
Current velocity: Vector { x: 0.00023975588491717534, y: 0 }
Current velocity: Vector { x: 0.00026155187445510035, y: 0 }
Current velocity: Vector { x: 0.0002833478639930254, y: 0 }
Current velocity: Vector { x: 0.0003051438535309504, y: 0 }
Current velocity: Vector { x: 0.00032693984306887545, y: 0 }
Current velocity: Vector { x: 0.0003487358326068005, y: 0 }
Current velocity: Vector { x: 0.0003705318221447255, y: 0 }
Current velocity: Vector { x: 0.00039232781168265055, y: 0 }
Current velocity: Vector { x: 0.0004141238012205756, y: 0 }
Current velocity: Vector { x: 0.0004359197907585006, y: 0 }
Current velocity: Vector { x: 0.00045771578029642565, y: 0 }
Current velocity: Vector { x: 0.0004795117698343507, y: 0 }
Current velocity: Vector { x: 0.0005013077593722757, y: 0 }
Current velocity: Vector { x: 0.0005231037489102007, y: 0 }
Current velocity: Vector { x: 0, y: 0 }
When the acceleration is greater than 0.02 (approximately), dynamic body accelerates as expected.
Here is the only mention of this bug (related to Box2d) that I have found on the web:
http://discuss.cocos2d-x.org/t/cocos2d-x-3-17-physicsbody-applyforce-still-works-wrong/42631
https://discuss.cocos2d-x.org/t/cocos2d-x-3-16-physicsworld-weird/39518
hi, I wonder is there a corresponding class in this lib for b2ContactPoint? I can't find it.
or is there a way to achieve this? thanks.
Not sure if people have been implementing debug drawing through b2Draw
but it looks like there is some deviation. For example, there is no PushTransform
or PopTransform
. It seems that in order to properly render the objects, one needs to apply the transforms.
Is this deliberate?
Hello,
Opening PRs about build configuration leads to conflicts, hard rebases and then be forgotten... I think it's a good idea to discuss about the build policy.
Here is what I recommend. Please comment if you disagree with args about so I can understand and maybe suggest something else:
Box2D/Testbed/dist
package.json
file (as well as tsconfig.json
, so it makes sense)module: es2015
/ moduleResolution: node
declarations: true
and specify declaration as typings
dist/Box2D
tsconf.json
if possible
dist/Box2D.dev.js
dist/Box2D.min.js
Please give feedbacks on these points.
Please notice that for the moment I use a custom configuration because your package does not work for me. Here is my branch with this config: https://github.com/Nek-/box2d.ts/tree/feature/many-output
If you're using box2d.ts for your game then make a comment below with a link to the github repo & the website!
Even if your game or application has just started - post a link! It will be nice to see how people are using this version of box2d.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.