Comments (19)
I'm not sure how it would be done using tQuery, hopefully @jetienne can provide some input.
Three.js let's you attach objects to other meshes, if you create an invisible box to use for the physics you can attach your car model to it as a child. this way Physijs will simulate using the box but ignore your non-Physijs geometry.
from physijs.
In theory that would be the simplest option but, like you say, have no idea how to implement this in tQuery. Especially considering I'm using the tQuery Car plug in also!
Will Jerome be aware of this issue/question?
from physijs.
Well, he would be aware of it if I pinged the right account. ping @jeromeetienne and sorry @jetienne
from physijs.
If you do drop by Jerome...
http://frontier.lincoln.ac.uk/3d/plugins/car/legoCar/
Here (if you wait 5 seconds without moving) you will see the car model behave as though it is attached to the physics volume it is added to (as a child). But now the camera and movement are not bound correctly.... (Car plugin)
from physijs.
Defintly interresting to bind car and physics! i am travelling today but i will look more this weekend
from physijs.
A basic interaction would be to associate the whole car to a box...
A more advanced one would be to get physics for the body of the car, to have one per wheels, and some springs between the body and the wheels...
I would love to be able to reproduce the buggy classic with three.js, see ccllff work
from physijs.
His work is awesome!
Hooking a simple collision hull to the car plug-in would be good and then expand to include a vehicle system... just like jiglibjs - and make it all work with tQuery! If you got even the first part working i'd be very happy!
If you need any help with testing then let me know!
from physijs.
ok about the keyboard control going crazy when applying physics to the car, this is normal/expected. both the physics and the car keyboard control are githing together to controls the car. You would need to rewrite it to make it talk to physijs.
from physijs.
about @chandlerprall suggestion of using an invisible box, it is possible to do that in tQuery
// create the container
var container = tQuery.createObject3D();
// add the carModel inside this THREE.Object3D
container.add( carModel );
// enable the physics on the container, and make it act as a geometry cube of 20,20,20
container.enablePhysics({
tGeometry : new THREE.CubeGeometry(20, 20, 20)
});
something like that should do
from physijs.
Perfect, thanks @jeromeetienne !
Hooking a simple collision hull to the car plug-in would be good and then expand to include a vehicle system... just like jiglibjs - and make it all work with tQuery! If you got even the first part working i'd be very happy!
I plan on adding a vehicle system to Physijs in the next couple of weeks - need to finish up constraints first. I don't think it would be difficult to add that layer to tQuery when it's ready, either.
from physijs.
@jeromeetienne - I will get on with implementing something similar to what you've suggested
@chandlerprall - That's awesome news, and perfect timing, I've been approached by a client who is interested in WebGL as a future platform for interactive game content. However the project is very tentative given that IE 10 still doesn't support WebGL - the swine's!
from physijs.
@jeromeetienne - container.enablePhysics is not a function
http://frontier.lincoln.ac.uk/3d/plugins/car/legoCar/
from physijs.
@jayfield1979 hmm... maybe because physics is at the mesh level. second try. This one is directly @chandlerprall suggestion with an invisible mesh
// create the container
var container = tQuery.createCube(20, 20, 20);
// add the carModel inside this container
container.add( carModel );
// enable the physics on the container, and make it act as a geometry cube of 20,20,20
container.enablePhysics();
// make it invisible
container.get(0).visible = false;
from physijs.
I came to the same conclusion as I also tried that:
http://frontier.lincoln.ac.uk/3d/plugins/car/legoCar/
from physijs.
I think you have to set material opacity to 0. Hiding the mesh should hide all children.
from physijs.
It did & still no obvious collisions as the example above demonstrates
from physijs.
another option is to completly remove link between the physics and the rendered object?
i mean. get the number the position physics give you. and set it yourself to the car.
It would avoid the visibility/opacity game
from physijs.
I will have a play after the weekend - using the physics positional data to affect the model sounds good...
from physijs.
Well, didn't get the physics working - but waiting for @chandlerprall to release his vehicle physics system.
But I did manage to model and animate a little character for the world which I thought I'd share if you're interested:
http://frontier.lincoln.ac.uk/3d/development/Stage2/characters/man.html
I know it's simple and needs optimising and the weighting is off but it's a first attempt. I am going to try and bind a simple physics cylinder to him and make him walk through the falling blocks - i'll let you know how it goes.
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.