Esenthel Wrote:in your case you should make 2 reversed boxes, and SEL_ADD them
Mesh room; room.createbox.reverse
Mesh corridor; corridor.createbox.reverse
Csg(room,corridor,SEL_ADD)
you can try also SEL_SUB instead of SEL_ADD
Yes, that's basically what I've been doing.
Soo code and pictures of the result incomming.
First a few explanations:
cuttingBox is a box placed at the place where the opening should be (the white lines in the picture is the box).
Rooms is a Memb of my Room struct.
m_RoomBox is the mesh of a Room, it is created the following way:
m_RoomBox.create(1).base(0)
.create(Box(m_XW, m_YW, m_ZW, m_Pos), VTX_TEX0|VTX_NRM|VTX_TNG).reverse();
m_RoomBox.setMaterial(material).setRender().setBox();
Now for the "chopp" part:
Mesh theCut;
theCut.create(1).base(0).create(cuttingBox, VTX_TEX0|VTX_NRM|VTX_TNG);
Csg(Rooms[i].m_RoomBox.base(0), theCut.base(0), SEL_SUB);
Rooms[i].m_RoomBox.setRender();
Rooms[i].m_RoomBox.setBox();
Results in:
[attachment=3]
Mesh theCut;
theCut.create(1).base(0).create(cuttingBox, VTX_TEX0|VTX_NRM|VTX_TNG).reverse();
Csg(Rooms[i].m_RoomBox.base(0), theCut.base(0), SEL_SUB);
Rooms[i].m_RoomBox.setRender();
Rooms[i].m_RoomBox.setBox();
Results in:
[attachment=2]
Mesh theCut;
theCut.create(1).base(0).create(cuttingBox, VTX_TEX0|VTX_NRM|VTX_TNG);
Csg(Rooms[i].m_RoomBox.base(0), theCut.base(0), SEL_ADD);
Rooms[i].m_RoomBox.setRender();
Rooms[i].m_RoomBox.setBox();
Results in:
[attachment=1]
Mesh theCut;
theCut.create(1).base(0).create(cuttingBox, VTX_TEX0|VTX_NRM|VTX_TNG).reverse();
Csg(Rooms[i].m_RoomBox.base(0), theCut.base(0), SEL_ADD);
Rooms[i].m_RoomBox.setRender();
Rooms[i].m_RoomBox.setBox();
Results in:
[attachment=0]
// Myx