Sevdat Posted July 5, 2023 Posted July 5, 2023 Why isn't it detecting the objects? The boundbox of the mesh is clearly in contact with the object, but instead it shows the building and the ground which it is not in contact with. Visualizer.RenderBoundBox(fork.BoundBox, fork.WorldTransform, vec4.BLUE); // write here code to be called before updating each render frame List<Unigine.Object> colliders = new List<Unigine.Object>(); bool collisionDetected = World.GetCollision(fork.BoundBox, colliders); for (int i = 0; i < colliders.Count; i++) { Log.Message($"center${i}:" + colliders[i].Name +"\n"); }
silent Posted July 5, 2023 Posted July 5, 2023 Sevdat By default objects are created without collison / intersection / physics intersection flags for better performance. Make sure that all the objects that you want to interact with have this options enabled inside the Editor: Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
Sevdat Posted July 5, 2023 Author Posted July 5, 2023 (edited) Good day Silent, I think you misunderstand. I'm trying to use the boundbox of the mesh in front of the forklift to detect when I get near a object so that I can attach the object to it, lift it up, move it around and so on. The problem is that bool collisionDetected = World.GetCollision(fork.BoundBox, colliders); doesn't detect the objects. For some reason it only sees the ground and the building. In the photo below i am nowhere near them, the array doesn't change even if I go to other objects. This is a problem because my next step is to make the crane lift objects up and move them around. I need the boundbox to act as a radar, but it doesn't work and I don't understand why. even if detached the problem persists Edited July 5, 2023 by Sevdat
vvvaseckiy Posted July 6, 2023 Posted July 6, 2023 Hi, BoundBox returns the coordinates of the bounding box in the node's local coordinate system, try using WorldBoundBox for finding world collisions e.g. bool collisionDetected = World.GetCollision(fork.WorldBoundBox, colliders); 1
Recommended Posts