Comments (8)
Scaling is the one feature of Three.js that I purposefully left out because it is a feature not supported by physics libraries. It would be impossible to update an object's scaling on the fly and a new collision body would need to be created every time the scale changes. This would be an expensive operation to do between frames if the user isn't planning for it, and I feel that cost is much more apparent if you are forced to create a whole new object if you change an object's size.
That said, I could use an object's scale at creation time for the physics body but I don't want to set up an expectation for the user that changing the scale later will have an effect. The only use case I can think of is if you are importing a custom geometry and want multiple sizes of it.
What are you trying to use scale to do?
from physijs.
thats actually a really good reason for leaving it out. its not really a problem, but it would be nice if it was hinted at somewhere in the documentation - i just spent a couple hours in confusion because i scaled my ground x100 as a BoxMesh and objects kept falling through. a mistake on my part that hopefully no one else makes
from physijs.
I apologize for the confusion - I've added a page to the wiki to help address this.
from physijs.
That said, I could use an object's scale at creation time for the physics body but I don't want to set up an expectation for the user that changing the scale later will have an effect. The only use case I can think of is if you are importing a custom geometry and want multiple sizes of it.
@chandlerprall I have bumped into that exact use case: I'm loading a few different rock models and I want the size of each individual instance be randomized to give extra variance to the scene, but I also want to reuse the geometry.
As far as I know, THREE.Geometry
doesn't have a scale property, so the scale would need to be another parameter to Physijs mesh constructor, but that way it should also be apparent that the scale is a construction time option.
from physijs.
'scale' property is now respected when adding a mesh to the scene.
from physijs.
Thanks!
from physijs.
It doesn't seem scaling works for Physijs.ConcaveMesh:
var groundMesh = new Physijs.ConcaveMesh(geometry, faceMaterial, 0);
groundMesh.scale.set(10, 10, 10);
scene.add(groundMesh);
The mesh appears and can be collided with, but it is considered to be it's default size by the physics engine. I had a look at 1afa96b, then added a breakpoint at line 784, and the ConcaveMesh doesn't seem to have object._physijs.width
and friends. Setting those variables manually to 1 doesn't help either.
Thoughts?
from physijs.
@lazd mind creating a new issue for this? It's a simple fix but I'd like an active ticket so I don't lose track of it and forget.
from physijs.
Related Issues (20)
- 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
- Is it possible to set restitution on objects?
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.