You’re quite right. I started writing my post with that goal in-mind but as it started progressing i changed what i was after.
I do apologize for that confusing inconsistency.
.
I’ve been able to do some of the things i’ve set out to do, but it only works on some faces, doing them all would require a ton more code and step-by-step trial-and-error, and i am pretty sure Panda has a much easier solution to what im trying to do.
I don’t think Panda3D has any easy way of building objects out of rectangular prisms; it’s a not exactly a standard feature for games.
However, I think you could at least do this with cubes pretty easily:
# collEntry is the CollisionEntry of the cube you clicked on.
clickedCube = collEntry.getIntoNodePath()
normal = collEntry.getSurfaceNormal(render)
cubeCenter = clickedCube.getPos(render)
newCubeCenter = cubeCenter + normal * cubeWidth
# Now make a new cube, and set its Hpr to that of the clicked cube, and its position to newCubeCenter
This is assuming that you are adding the cubes as children of render. You’ll need to adjust the getSurfaceNormal and getPos calls if the cubes have some other parent.
It also gets trickier with non-cubic geometry, since you need to figure out what the orientation should be. If you want to build on top of larger objects, like in your screenshots, I’d recommend tiling the surfaces with invisible squares, and detecting collisions against the squares. Then you just place new objects on top of the square that was clicked.