this is my scene model, I need to implement a function is the scene of linkage, when I click on a certain floor, he should go to judge me under the current floor had collision model and which model (because of my lower floor also allows drag model) of the upper floor, then go to upwards to find know no collision model, and finally the currently selected floors high than I did in those models is hidden;So I want to ask you, what should I do
Hi ranwei. When you say âcollisionâ, maybe you mean âpickingâ? IF SO, maybe you could use scene.multiPick. It returns array of ALL things hit with pick⌠then you decide which mesh is selected/picked.
Maybe layerMasks, maybe renderingGroups. Your building has layers, right?
Perhaps, when you hide something, use mesh.setEnabled(true/false) and not visibility/alpha.
I donât understand your post very well, so I am giving general advice. Iâm not sure if you REALLY mean âcollisionâ or if you REALLY mean âpickingâ.
If picking problem, check multiPick and multiPickWithRay. If multiPick returns array.length > 1, then multiple things were picked (in picking-depth order), and you need to decide WHICH picked mesh is the desired picked mesh.
Also, maybe you want to set bottom floor isPickable = false⌠IF upper floor is blocking/unhidden. Then when upper floor is hidden, re-set lower floor isPickable = true, to allow bottom floor dragging again.
Careful layers/renderGroups management, and careful isPickable and setEnabled() management too, perhaps. My advice might not fit your need. Just some ideas. Stay tuned for more comments.
Short answer: Do the function .
At least try something with simple boxes maybe and put a link with the code here. Unfortunately I really donât understand what do you want to archieve
aaaand
!!! Please donât post your issue in ânâ different topics which donât have to do with your problem. !!!
!!! Donât create multiple topics for the same issue. It is not the first time when you are doing this. !!!
How to say? The previous project of the company was implemented by C++, which was to add AABB bounding boxes to the model, add each one, and then detect the collision, which models have collision to the model you selected, and then calculate the position and so on, and only obtain the above model, etc., like this.
sorry!But Iâm really in a hurry, and I really donât know how to get started on this, and second of all, itâs useless for me to put up the code, because I havenât even started this feature yet, right
http://120.78.84.216/
This is what I put on the server, and then I can look at it
for the collision pickup you mentioned, is it done by the camera emission line?
Ah, boundingBox collision between floors. (not a picking issue). Sorry, I was confused.
Maybe bounding box âintersectionâ testing?
https://playground.babylonjs.com/#KQV9SA#0
Also, see console.log(mesh.getBoundingInfo().boundingBox); There are many properties on a mesh boundingBox⌠for measuring its width, height, depth. (often called âextendsâ). So you can measure stuff, and set positions of floors⌠by stacking them (because you can do boundingBox measuring).
Maybe THAT will help?
this is my GetBoungdinginfo() for each grid, but I donât know what I can do with it
I would like to try this collision event to get which models my current model has collision with, but it doesnât seem to be of any use
according to what you said, when I click on a node, I get the boundary box information of the model under the node. Then how can I get the coordinates of each model that collids with it through calculation, and then judge that the model above my current model chooses to hide
I donât think you need onCollideObservable, but I am still not sure what you are trying to do. I am having problems understanding the objective.
Stacking floor-levels? Get extendsY of bottom mesh, then negative extendsY of upper floor/level⌠then you can position top floor perfectly atop bottom floor. (perfect stack).
But I am confused. Do you want to drag top level and make it âsnapâ to top of bottom level? Iâm trying to help, but i donât understand.
Do you know how to upload a video to reply others? If yes, I can upload a video to you directly
I have tried to understand your posts. Using a different language must be very frustrating.
Collision may be the wrong word for you to use.
Objects can only collide if they are moving, here is a video of a grey car and a red car collide YouTube
Two meshes collide if one or both of them are moving and at some point they meet.
Perhaps you need the word touch?
https://www.babylonjs-playground.com/#MECK03
If the playground above the red and green boxes touch. You can also say the red and green boxes are in contact.
So the red box touches the green box, the yellow box, the blue box, the purple box and the black box.
You can also say the red box is in contact the green box, the yellow box, the blue box, the purple box and the black box.
You can also say the red box is next to the green box, the yellow box, the blue box, the purple box and the black box.
Here is another playground https://www.babylonjs-playground.com/#MECK03#1. Each floor is a different color. Can you explain what you want to happen when you click on one of the boxes on the green floor?
Let me see if I understand this correctly.
- You want a player object to have collision response with the building models.
- When the system registers a collision on a New floor, detect all floors Above the player object, and make them invisible, so that in a top-down or third-person-camera setup, all you see is the floors beneath the player, so that if the player moves up stairs or a slope to a new floor, no further floors or roof are obstructing the view.
Simple example: Babylon.js Playground
(WASD to move)
Not quite sure this is what youâre after, though.
Am I understanding you correctly?
The key is that I have no players, this is not a game, just a show, I click on the level of the directory tree, and then decide what to show and hide
I donât see any touching, itâs just setting him up so they can be together
For what you just said, collisions, itâs true that the static model has no collisions.I always thought that I made a mistake, but if there is no collision detection, is there any other way to detect the model above me, because the function I need is to interact with the above model with the current model to see if I can choose to hide the above model
I uploaded a video directly, you can look at it, and then you know what I mean