157 questions
1
vote
1
answer
100
views
Cannon vehicle moving on its own
I'm implementing a 3D truck simulator and I'm facing a problem with the trailer: it moves on its own.
Here are some details and context:
The ground is perfectly flat and horizontal
The wheels have ...
0
votes
1
answer
62
views
Shot cool down in Three.js and CANNON.js
its been a while since I worked on this project but I have just come back to it and turns out its broken. I did some testing and I was able to pin point the problem but I have no clue how to fix it. ...
1
vote
0
answers
67
views
I am not able to get a stable orbit in this three js and cannon js simulation
I am trying to create an app which simulates celestial bodies in space.
I am using three.js for rendering and cannon.js for physics simulation. Here with this code I am not able to get a stable orbit ...
1
vote
0
answers
18
views
Modelling blender limit location extention/retraction in Three.js and cannon-es
I am trying to load a .glb file created in blender to a three.js with cannon-es for physics/gravity.
My goal is to be able to extend and retract each individual actuator added to my model. The model ...
1
vote
1
answer
107
views
three js and cannon js gravity falling apart
I am trying to make those little interractive balls that are on some websites, but when i try to increase the ball size not only do they not get bigger but the gravity falls apart, and i am just so ...
0
votes
1
answer
69
views
How to make a cannon.js body copy a Three.js Object3D that's in the camera group?
I have a sword model in the camera using camera.add(sword), but how would I get cannon.js body to copy that sword position and quaternion? I tried adding the cannon.js body to another that is acting ...
0
votes
1
answer
35
views
Identifying required surfaces to add shadows in three js
I'm learning three js recently and I'm trying to mimic the scene which is present in below link by downloading the model
https://sketchfab.com/3d-models/ccity-building-set-1-...
4
votes
1
answer
1k
views
My glb file is not loading into my three.js file
My glb file wont show up inside my thee.js world. I have followed all the documentations and tutorals but nothing works. the world loads and evry thing works fine its just that the moddle dose not ...
0
votes
0
answers
44
views
From Cannonjs Quat to GLMatrix rotation modelView - fromQuat not working
I use glmatrix 3.4.0 .
Any suggestion !
mat4.identity(object.mvMatrix);
this.mvPushMatrix(object.mvMatrix, this.mvMatrixStack);
mat4.translate(object.mvMatrix, object.mvMatrix, object.position....
1
vote
0
answers
213
views
Converting Cannojs 3D world vectors to model-view matrix
I use glmatrix 3.4.0 .
With position i dont have any problem.
Event glmatrix last version have some support for QUAT i cant make correct way of converting from QUAT to AxisAngle or rotate mat4 ...
I ...
1
vote
1
answer
98
views
How to create exact sized shapes with ConvexPolyhedron in Cannon-es and Three.js
I'm trying to create a tetrahedron in Three.js along with a corresponding Cannon.js body using ConvexPolyhedron. However, I find myself having to guess the vertices and faces for the shape, like this.
...
0
votes
1
answer
344
views
Create CANNON body from THREE. Mesh
I have a THREE.js plane that the points are moved up and down using Perlin noise to make terrain. Now I need to add physics to the camera to stop it from just falling through the plane.
I'm hoping to ...
0
votes
1
answer
97
views
Cannon-js. Dynamic body bouncing on y axis when force is applied to x and z axis
so i have a player controller for an fps game that applies force based on keyboard inputs to a dynamic cannon body. angularDampining=1 on the player body. the playercontroller class takes both in the ...
0
votes
1
answer
201
views
When ever i try to use cannon.js the screen goes blank
i have tryed somany ways but i cant get cannon.js to work in my code. when ever i try to make a world it just goes blank, please help. I cannot find any links or ways to get it to work. I am a new ...
1
vote
1
answer
91
views
Cannonjs collision handling
I have two cannonjs boxes. Box1 serve as character that moves with arrow keys.Box 2 serve as house . When i move Box1 towards Box2 , Box1 gets sliding to very large distance continuously. I want that ...
1
vote
0
answers
75
views
How do you make a fps/parkour movement script in cannon.js and three.js?
I've been trying to make a good movement script for a few months now but the one I have now isn't very good. (I'm still a beginner).
This is my code:
import * as THREE from 'three'
import { ...
0
votes
1
answer
221
views
How to copy shape of CANNON.js body from a THREE.js IcosahedronGeometry object?
I am trying to make a simple 3D object with Three.JS and CANNON.js, but cannot seem to make the collider shape match the visual object's shape.
I am creating my shape
const geometry = new THREE....
0
votes
1
answer
150
views
Can change position of a mesh using useRef but not with Cannon.js in React-Three-Fiber
When I use useRef for access a mesh, I can change its position as this:
const [boxRef] = useRef();
...
boxRef.current.position.setX(boxRef.current.position.x + 1);
And it works! But when I use useBox ...
1
vote
0
answers
244
views
Cloth simulation
I'm trying to create a cloth simulation using @react-three/fiber and @react-three/cannon.
I created particles that respond to physics. However, I would like to reproduce this behavior on cloth. ...
1
vote
0
answers
162
views
Three.js Cannon.js Cylinder rotates weirdly
I'm trying to use CANNON.js with three.js. All is working well with cube, sphere, and plane, but now when I try with Cylinder, it is rotating weirdly. I do NOT want to rotate the three.js object to ...
2
votes
0
answers
1k
views
Updating position and rotation of a RigidBody or MeshCollider and making it follow along it's child mesh, using react-three/rapier or cannon
So I have a react-three/fiber scene component, where I am animating a rigged character. I want to apply colliders to eg. the hands, so that the movement and rotation of the skinned mesh will apply to ...
2
votes
1
answer
1k
views
Deterministic Dice Roller with react-three-fiber
I found this great example of creating 3D dice with react-three-fiber at https://codesandbox.io/s/reverent-lalande-5qdk4j. I want to do something similar but with deterministic rolling, meaning I can ...
1
vote
0
answers
114
views
How do I convert a rotation described by three coordinates into a quaternion?
Question: I have a 3D rotation specified by three coordinates. How do I transform this into a CannonJS quaternion to physically rotate the body?
// I saw this online:
var qX = new CANNON.Quaternion()
...
0
votes
1
answer
227
views
CannonJS Massive friction (sticky) on "east" facing walls while having a 0 friction
Currently in my game, I have a character with spheres as its collision box with 0 friction.
When moving into walls everything works smoothly as intended (I'm setting the character body's velocity)
...
2
votes
0
answers
160
views
How can I create a gravitational attraction between objects with cannon.js and three.js?
I can create gravity in the whole world but I want to create a gravitational attraction between objects so I can simulate planets and stuff.
I tried making a function for Newton's law of universal ...
0
votes
1
answer
1k
views
Objects falling through the ground plane in cannon.js and three.js
I recently started working with physics engines. I am using cannon-es.js with three.js.
The box and the loaded model are just passing through the plane and falling out of view. I tried using ...
0
votes
0
answers
289
views
How can I make spheres behave more rock solid and less bouncy - Three.js and Cannon.js project?
I'm working on a uni project with 3D JS, using Three.js, Cannon.js, and DragControls. I'm having some trouble with the behavior of my spheres. Whenever they get pushed into each other and let go, they ...
1
vote
0
answers
99
views
Why is my imported model moving so little, compered to physics from cannon.js?
I want to create a vehicle, that moves around in three.js and cannon.js. But when I update the position of the three.js model it moves so little also backwards I have no Idea what is causing the ...
0
votes
1
answer
351
views
How to do the cannon-es body of a three.js torus?
I want to do the cannon-es body of a THREE.js Torus, and I am not finding the right shape. Sadly there's no built-in CANNON.Torus class.
For reference, This is how a THREE.js Torus looks like:
Any ...
1
vote
2
answers
480
views
cannon-es crashes whenever there is a collision between Convex polyhedrons
I am trying to implement a dice roller in three js and cannon-es.
It works perfectly fine if I have only one dice. It rolls against the ground plane in a reasonable way.
When I add another dice it ...
1
vote
0
answers
107
views
3D Character rolls with sphere
I am trying to make a spider have a certain velocity when control keys are pressed using react three cannon. The 3D model rolls along with the sphere.
The code is as follows:
// import { useFBX } from ...
1
vote
0
answers
85
views
Logic for jumping in webgl with physics enabled
Most important code just for example. Func UPDATE is called in every draw frame.
I want implement jumping virtualJumpActive == true logic.
I invert procedure for virtualJumpActive == true to make ...
1
vote
0
answers
292
views
How to correctly control the rotation of the wheels on the car - three.js & cannon-es
I cannot combine the horizontal movement of the wheels with the vertical movement.
Additionally, the wheels only move forward. I have no idea how to check if the vehicle is moving forward or backward ...
0
votes
2
answers
1k
views
React Three Fiber/use-Cannon How to make enclosed boundaries for physics objects?
I want to position a box within a floor and 4 walls so the boxes movements would be within a constraint. This example shows a floor and backwall and works fine. However. I want to add left/right and ...
1
vote
0
answers
1k
views
THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN
I've found this question asked before but the solutions offered did not solve my issue. I've tried creating this project in only @react-three but I've added vanilla three and cannon to supplement my @...
2
votes
0
answers
1k
views
Three.js & @react-three/fiber - TextGeometry() cannot read properties of undefined (reading 'yMax')
I'm getting the error "Uncaught TypeError: Cannot read property 'yMax' of undefined" when adding text to a three.js scene using React-three/fiber. I've successfully rendered other geometries ...
5
votes
0
answers
615
views
useConvexPolyhedron collision on react-three/cannon clipping through object
I am having issues trying to make collision work properly with an imported glb file only used for collision.
There are two parts to this question:
I am currently getting a whole lot of faceNormal ...
0
votes
1
answer
130
views
cannon.js basic physics setup as class in three.js
Very new to coding and Im following a course on three.js using cannon-es, I have quickly come to understand the need to keep things organized in classes using constructor, (my project is currently all ...
1
vote
0
answers
488
views
cannot detect collisions in the room model loaded from glb
I am creating a first person game.
The room model has only walls and floors.
The model is npx gltfjsx . /public/box2.glb and converted to React code.
It is then loaded using GLTFLoader.
The model I ...
1
vote
0
answers
35
views
Browsers giving wrong readings for MovementX
I'm currently making a simple fps movement based game in three.js using cannon.js physics.
But I've run into a problem with my first person controls
function onMouseMove( event ) {
if ( scope....
1
vote
1
answer
1k
views
Apply Physics (CANNON.JS) to Camera (Using Pointer Lock Controls) in THREE.js
I wanted to ask. I have this goal to create a Pointer Lock Control but also apply physics to the control, so when the camera hit a wall it doesn't move to that direction (Where collision occur). My ...
2
votes
2
answers
896
views
react-three/cannon : offset around the GLTF model, model dosent touch the floor
i'm trying react-three/cannon and my goal is to drop a "Cube" and a "GLTF model" from a position and let them land on a "Floor".
it works well for the Cube (he touches ...
0
votes
1
answer
1k
views
Adding Cannon.js Body to Three.js Mesh causing Vec3 error with groups and multiple shapes
Basically I've created a group of 2 meshes in Three.js and a Body containing 2 Shapes in Cannon.
Separately they appear fine but when I copy the Body position to the meshes to add physics the code ...
1
vote
1
answer
446
views
I can't get this demo to work on my computer in three.js and cannon.js from sandbox
Here is the demo but it always says that I am missing the modules whereas I have all the dependancies : https://tympanus.net/codrops/2020/02/11/how-to-create-a-physics-based-3d-cloth-with-cannon-js-...
0
votes
1
answer
1k
views
How to add colliders to walls and floor on a Sketchfab .GLTF 3D model, using react-three and react-three/cannon
I've started my journey of making an interactive gallery using react-three. I already have the First-Person mechanics figured out and I made a small room to walk and interact. I want to escalate the ...
0
votes
1
answer
2k
views
React Three- Code a 3rd person view camera
I'm trying to set dynamic camera position behind the car implemented in a project similar to
CAR using raycastVehicle
I tried to change camera's position using state/hooks, but I am unable locate car'...
-1
votes
1
answer
487
views
Uncaught TypeError: CANNON.NaiveBroadPhase is not a constructor
i am learning cannon.js and i am have this error Uncaught TypeError: CANNON.NaiveBroadPhase is not a constructor
i tried so many things but nothing is working.
and here is my script:
var scene, camera,...
1
vote
1
answer
2k
views
@react-three/cannon hooks changing value of matrixAutoUpdate to false
I'm having some difficulty getting my camera to follow an object. The object is using a hook useSphere from @react-three/cannon. My sphere moves around fine, but the camera does not follow. Ive ...
1
vote
1
answer
838
views
Is there any thing like origin point in Three.js
Please I want to know if there is anything like origin point in three.js just as we have it in Blender, please I have tried to do a research on this topic but to no avail. I want to make a pinball ...
0
votes
1
answer
376
views
Avoid wake up on collision
I'm working with cannon-es (a maintained fork of cannon.js). I need to fix an object in space for a certain period of time. So, I do body.sleep() in these cases.
The problem is that object can ...