gkjohnson / three-mesh-bvh

A BVH implementation to speed up raycasting and enable spatial queries against three.js meshes.
https://gkjohnson.github.io/three-mesh-bvh/example/bundle/raycast.html
MIT License
2.5k stars 260 forks source link

[Question] Make collision smoother #683

Closed AshhadDevLab closed 3 months ago

AshhadDevLab commented 3 months ago

Description

Hi there I was making collision system in three.js using boundingBox and it turns out that the collision works great with the limitation that all the collide-able objects should be axis aligned. This was a road blocker for me so I switched to Three-Mesh-BVH to check the collision using boundingTree its working perfectly the only issue I am facing now is that when the object collides it acts rather glitchy.

Here's the glitch to get better visuals of the collision:

Glitch

When I was working with boundingBox I made a logic that when the box is still colliding it will move in the direction its not colliding in. Which made a smooth collision effect, If someone can help me regarding this I'll be very grateful and thankful.

What I need

To make the draggable box to move in the directions its not colliding in, thanks in advance

gkjohnson commented 3 months ago

Hi Ashhad - these types of interactions such that a dragged objects smoothly move across an arbitrary surface can be fairly complex and involve a lot design choices. Unfortunately I can't provide debug or design help for user applications or features here. If you hav a specific question about the three-mesh-bvh API I'm happy to answer but otherwise I think the three.js forum may be a better place to ask:

https://discourse.threejs.org/