GithubHelp home page GithubHelp logo

Comments (8)

chandlerprall avatar chandlerprall commented on July 23, 2024 2

@tmclemons I would recommend creating your own ray-based collision detection for that purpose - a full physics implementation seems like over kill to me.

That said, you could create a box or cylinder mesh and attach the camera to the mesh. To move around you would call setLinearVelocity on that mesh with the direction you want to move.

from physijs.

chandlerprall avatar chandlerprall commented on July 23, 2024

If you have already set up the scene , you need only to change

var part1 = new THREE.Mesh( geometry, new THREE.MeshFaceMaterial() );

to

var part1 = new Physijs.BoxMesh( geometry, new THREE.MeshFaceMaterial() );

And use the appropriate Physijs Mesh in place of BoxMesh

from physijs.

mika-co avatar mika-co commented on July 23, 2024

i don't have problem by normal box
i have problem by loader model
i change code
car_loader.load( "obj/camaro/CamaroNoUv_bin.js", function(geometry) {
var part1 = new Physijs.BoxMesh( geometry, new THREE.MeshFaceMaterial() );
car_mesh = new THREE.Object3D();
car_mesh.add( part1 );
//var mesh = new THREE.Mesh(geometry, material);
car_mesh.position.set(0,2,0);
car_mesh.rotation.set(0,0,0);
car_mesh.scale.set(1,1,1);
car_mesh.add(camera);
scene.add( car_mesh );
});
but not work

and change
car_mesh = new THREE.Object3D();
to
car_mesh = new Physijs.ConvexMesh();
have error

from physijs.

chandlerprall avatar chandlerprall commented on July 23, 2024

You shouldn't add Physijs meshes to non-physics bodies (such as the car_mesh Object3D). What I would recommend is to create an invisible physics box for the car_mesh and add the geometry to that object. See #26 for more discussion on doing this (although it talks about using tQuery the principles and ideas are the same).

from physijs.

tmclemons avatar tmclemons commented on July 23, 2024

How would someone apply Physijs to a FPS camera? I ask because I want to set-up a camera to move via FPS through a maze, issue is I have walls that I don't want camera to go through, and I have a ramp that I want the camera to climb as it moves.

Thanks!

from physijs.

tmclemons avatar tmclemons commented on July 23, 2024

You would have to excuse me because my background is mostly in 3D modeling and I am new to three.js oriented coding. Would you know an example already present where I can insert the camera into the geometry and control the camera using FirstPersonControls so that it does not intersect the geometry of a wall. Thanks!

from physijs.

chandlerprall avatar chandlerprall commented on July 23, 2024

To add a camera to a geometry: mesh.add( camera );

Unfortunately the first person controls don't have any kind of collision detection. The topic has come up quite a bit on the three.js IRC channel - I'd recommend going there and asking for advice on implementing this functionality.

from physijs.

TitikshaDaga avatar TitikshaDaga commented on July 23, 2024

@chandlerprall how can I use Physijs for ionic framework?

-Thanks in advance!

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.