Jump to content

Collision box of mesh not detecting objects


photo

Recommended Posts

image.thumb.png.1ce72ad2d59d8698cced25df68ad5e52.png

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");
		}

 

Link to comment

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.

image.thumb.png.f2e089fef4fecae28b77036ec8732cb9.png

image.thumb.png.efa9613510091957575869fddf17ea20.png

even if detached the problem persists

Edited by Sevdat
Link to comment

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);

 

  • Like 1
Link to comment
×
×
  • Create New...