My scene is an imported gltf model, which contains several buildings and a ground. The interior of the buildings are hollow and can be passed through.I have used collision detection for each Mesh in the scene, and ArcRotateCamera has also enabled collision detection.
But when I moved the camera, I found that it would get stuck when passing through certain buildings.
As shown in the picture, I use the top midpoint of building A as the target of ArcRotateCamera. When I approach building A until ArcRotateCamera passes through it, it will not get stuck, but when ArcRotateCamera passes through B, it will get stuck.
Hi, I found a similar problem. I couldn’t come out after entering the model, I couldn’t even rotate the lens, or I couldn’t move it when attached to a wall. Almost all walls in the model I used were composed of extruded splines. so how can I deal with it? Should I modify the code or modify the original model?
I am considering whether it is a model problem. I want to perform collision detection on an entire building. The desired result is that when the camera touches any part of the building, it will collide and move away. Based on the content of the two forums I mentioned earlier, I guess that maybe the camera is stuck in the model.
The model of the building is not a whole, its mostly includes: an editable poly in the middle, the ceils and the surrounding walls are all extruded Editable Spline, and all of the components are not combined into a group.
When I hit the surface of a building with a camera, sometimes it seemed to be stuck to the surface, sometimes stuck in the wall, and sometimes stuck inside after passing through the wall (I have set the minZ of the camera to 0.1 and it can pass through the wall).
I don’t know much about modeling, this model is provided by others, so I don’t know how the creation and organization of the model affects the collision.
Sorry for my cumbersome expression, if you can understand what I mean, can you give me some suggestions?
I think it is indeed the problem of the model. After I changed the model, the above problem did not occur.But I still want to know what is wrong with the previous model
Make sure the model’s normals are pointing outwards and that the model is not, for some reason, inverted. The collision relays on this data and if it is wrong you will be “stuck” inside the model.