Giter Site home page Giter Site logo

Comments (19)

chandlerprall avatar chandlerprall commented on July 18, 2024

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.

jayfield1979 avatar jayfield1979 commented on July 18, 2024

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.

chandlerprall avatar chandlerprall commented on July 18, 2024

Well, he would be aware of it if I pinged the right account. ping @jeromeetienne and sorry @jetienne

from physijs.

jayfield1979 avatar jayfield1979 commented on July 18, 2024

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.

jeromeetienne avatar jeromeetienne commented on July 18, 2024

Defintly interresting to bind car and physics! i am travelling today but i will look more this weekend

from physijs.

jeromeetienne avatar jeromeetienne commented on July 18, 2024

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.

jayfield1979 avatar jayfield1979 commented on July 18, 2024

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.

jeromeetienne avatar jeromeetienne commented on July 18, 2024

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.

jeromeetienne avatar jeromeetienne commented on July 18, 2024

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.

chandlerprall avatar chandlerprall commented on July 18, 2024

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.

jayfield1979 avatar jayfield1979 commented on July 18, 2024

@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.

jayfield1979 avatar jayfield1979 commented on July 18, 2024

@jeromeetienne - container.enablePhysics is not a function

http://frontier.lincoln.ac.uk/3d/plugins/car/legoCar/

from physijs.

jeromeetienne avatar jeromeetienne commented on July 18, 2024

@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.

jayfield1979 avatar jayfield1979 commented on July 18, 2024

I came to the same conclusion as I also tried that:

http://frontier.lincoln.ac.uk/3d/plugins/car/legoCar/

from physijs.

chandlerprall avatar chandlerprall commented on July 18, 2024

I think you have to set material opacity to 0. Hiding the mesh should hide all children.

from physijs.

jayfield1979 avatar jayfield1979 commented on July 18, 2024

It did & still no obvious collisions as the example above demonstrates

from physijs.

jeromeetienne avatar jeromeetienne commented on July 18, 2024

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.

jayfield1979 avatar jayfield1979 commented on July 18, 2024

I will have a play after the weekend - using the physics positional data to affect the model sounds good...

from physijs.

jayfield1979 avatar jayfield1979 commented on July 18, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.