- Home /
Sticking object on mesh
Hello. Please help me. I need to stick an object on mesh collider properly. What I mean. A draggable object contains rigidbody and a box collider, another object consists of procedural-generated mesh and corresponding mesh collider (plus kinematic rigidbody). I need to stick first object on the second one and orient it accordingly (i.e. if it touches the left edge make it's up axis look to the left and so on).
The best thing I could test was to lock the moving if the object touches mesh. I tried to treat the deal with getting `collider.ClosestPointOnBounds()` but it seemed to me not to work properly. What should I do? Please help me.
No, it's simple. $$anonymous$$y case is far more complicated - I need to STIC$$anonymous$$ an object to arbitrary mesh collider. In the other words, I need to find such points on the mesh collider that I could use as the control points, find a normal and position object accordingly.
i really don't know what you're asking. the term "STIC$$anonymous$$" means nothing and it's not a term of art in the scene or anything I've heard, sorry! heh.
do you mean you want to actually modify the mesh of the large object to include the new object?
I don't know what "stick" mean, if you use .parent that absolutely - positively - definitely STIC$$anonymous$$S the item on the other item so they will never ever separate. it's as if it is one mesh.
Sorry, I used a wrong word approach maybe. What I mean is to snap an object with box or sphere collider on the surface of mesh which is generated by script.
Your answer
Follow this Question
Related Questions
Why is my mesh collider not the same shape as the mesh of the object? 1 Answer
Technique to find a mesh intersecting with a primitive solid without using colliders? 0 Answers
MeshCollider (concave) doesn't trigger OnCollision functions 0 Answers
add mesh to trail renderer and MAKE IT SOLID !! 1 Answer
Pushing a mesh with mesh collider 1 Answer