Comments (5)
The bullet functions can't deal with a native JS object like that, I think that is the problem here. getOpenGLMatrix receives a simple float pointer. You should allocate some memory and pass it that pointer, then read from that memory. This might work but I haven't tested it:
var buffer = Ammo.malloc(16*4);
transform.getOpenGLMatrix(buffer);
var jsBuffer = HEAPF32.subarray(buffer/4, buffer/4 + 16)
Ammo.free(buffer);
from ammo.js.
malloc and free don't seem to be accessible. Here's something I tried. It runs, but doesn't seem to produce the correct matrix.
var buffer = Ammo.allocate(16, 'float', 1 /* ALLOC_STACK */);
var transform = new Ammo.btTransform();
transform.getOpenGLMatrix(buffer);
var matrix = Ammo.HEAPF32.subarray(buffer / 4, buffer / 4 + 16);
// Ammo.free(buffer);
Ammo.destroy(transform);
from ammo.js.
@cjcliffe , you were doing something similar to this, I think? Do you remember what worked for you?
from ammo.js.
Note that in the example above, you need to allocate 16*4 because each float takes 4 bytes.
from ammo.js.
Is there any update to this? I would like to use that function if it is possible.
from ammo.js.
Related Issues (20)
- How to improve the performance of physical scenes? HOT 1
- Custom SDF callback possible?
- How to use setUp or setUpAxis on btKinematicCharacterController
- When the clone model is introduced and added to the AMMO world, the position parameter becomes NaN
- _free is not a function (ammo.wasm)
- Debugging ammo.wasm.wasm using DWARF HOT 2
- Export some classes please
- rotation not what is set
- btRigidBody applyForce applyImpulse methods missing? HOT 1
- set functions for softbody anchors do not work
- Collision stops working after softbody deformation HOT 1
- Cannot parse with webidl2 because `B implements A` doesn't seem to be valid syntax
- ReferenceError: 'setTimeout' is not defined
- Memory access fault on constraint creation HOT 1
- I created a un-official ammo.js documentation HOT 1
- Need softBody self-collision API
- sbConfig.set_collisions()
- Error 'b._free is not a function' while adding multiple soft bodies. HOT 1
- btRaycastVehicle not syncing position on moving platform
- Include `btTransformUtil` functions? HOT 1
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 ammo.js.