Comments (8)
Just had a closer look at the worker thread etc.. It appears that the plane is mainly represented by it's normal - possibly I'm needing the heightfield structure you mention @ #12
from physijs.
So I suspect vehicles & terrain will be ready in early June - we'll see if I can stick to that plan :)
Obviously that didn't work out as planned. But yes, you will need the heightfield body for what you want to do. Constraints are finished apart from good examples so I can start looking at the heightfield stuff again. When have you been planning on releasing (so I can prioritize)?
from physijs.
I don't have any release date. It's something I've been working on for the odd hour after work for about 2 months now. I'd estimate that I'm around 30% of the way through so far so it could be around November.
I have many things on my to-do list so it's easy for me to switch to something else in the meantime. I'm sure you're also busy with other projects and there are ways for me to work around it so don't worry too much as I'm aware that it's not a trivial piece of work.
If there are any ways I can contribute, I'd be happy to? I was thinking about trying to attempt this myself using multiple 'triangle' shape models that you have in the worker thread, generated from the plane.. let me know if you think that'd work?
thanks again
from physijs.
I plan to release something incomplete within the month.
from physijs.
If there are any ways I can contribute, I'd be happy to? I was thinking about trying to attempt this myself using multiple 'triangle' shape models that you have in the worker thread, generated from the plane.. let me know if you think that'd work?
Your approach should work but I don't think it would perform well. Here is a write up I sent to someone a couple of months back on what will need to be done for heightfield support - the biggest challenge has been getting the vertice positions into the heightfield correctly.
A heightfield mesh is a physics body which is calculated from a height map. In case you don't already know, here's an overview of how Physijs works:
Physijs - two script files - physi.js and physijs_worker.js
- physi.js provides everything the developer needs. This includes the custom Scene and *Mesh objects and their functionality
- physijs_worker.js manages the Ammo.js world and physics objects themselves (Ammo.js is the actual physics library, and is a port of Bullet Physics which is written in C)
To implement a heightfield mesh
- New HeightfieldMesh object would be needed in physi.js - this object would read the height field data either directly from the vertex locations from a THREE.PlaneGeometry object (preferred) or would accept some array or multi-diminsional array with the height field data.
- physijs_worker.js would need to know about the new shape definition in the createShape method - https://github.com/chandlerprall/Physijs/blob/master/physijs_worker.js#L59 This method would take the height map data and create a btHeightfieldTerrainShape object ( http://bulletphysics.com/Bullet/BulletFull/classbtHeightfieldTerrainShape.html#_details
There is some weirdness to implement a btHeightfieldTerrainShape however. The function definition in the Bullet Physics library takes the height map data as a pointer. The way Ammo.js handles this is interesting, but there are some examples of it online. An existing github issue for adding heightfield to Physijs is here - #1 and there are links in that ticket to an example where the heightfield shape is used with Ammo.js
from physijs.
Cool, I'll look into this tonight and get back to you
from physijs.
I've created the heightfield object. It's working well with my game!
All fairly straightforward to implement except for the pointer stuff which seemed to be allocating a piece of memory 4 times too large in the examples. Some of the allocation stuff has moved on since these examples regards naming of the heap object etc...
I've sent you a pull request.
from physijs.
from physijs.
Related Issues (20)
- Collision Event not firing HOT 2
- Refused to execute script (from xyz) because its MIME type ('text/js') is not executable. HOT 1
- How to deform an Physijs.SphereMesh like a WaterDrop?
- PhysijsWorker is not a constructor HOT 2
- How to move blocks out of blocks faster HOT 1
- how to load GLTF model ? HOT 2
- No updates for years, any recommendations for an alternative lib? HOT 3
- THREE.InstancedMesh is not supported
- How do I get the number of layers and roots with a mouse click HOT 1
- Objects after coming to rest are stuck in that state.
- Scenegraph Skipping collision checks - possible issue or me being silly
- How to check for an overlap event
- applyImpulse to object: vector: NaN ? HOT 1
- Use physijs to give three.js Questions about adding physical effects?
- When I used concavemesh to transform the externally introduced obj model, the browser reported an error
- Uncaught TypeError: class constructors must be invoked with 'new' when trying to create Physijs Scene HOT 3
- Vehicle physics HOT 1
- How to use it in vue-cli3?
- Döner alike fractal terrain rolled up
- Physi
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 physijs.