Hiding the walls when viewing the outer side

Hi everybody.

I don’t know very much about 3D programming, but by vicissitudes of life I must program a room editor. Fortunately, JME3 is very easy for newbies like me.

Well, I have this room editor. You select a wall object, pick it, and then drop in another wall or another position or another wall. My problem is that I only want to place objects in the inner side of the walls, but the outer side is always on the middle. It would be better if those walls just disappear, but reappear when the camera moves and the inner side is pointed.

As I knew I wouldn’t be able to explain it very well, I made some drawings.

The room is represented in top-down view. The black lines are the walls.The green… ehm… thing is the camera. The green lines represent the angle of vision. And the red lines represent what I would like to remove from the scene (not shown and not ray traced).

I have tried conditions with the camera position, the camera angle, the walls facing, … But I haven’t reached any solution yet.

Please forgive my lack of knowledge and the lack of accuracty with the terms.

To better explain what I’m trying to achieve, it would be similar (but less fancy) to when you play The Sims 3 and some walls are not displayed. Like in this picture.

Do you walls have an outside and an inside like in that last pic?

Otherwise, it could just be a matter of making sure back face culling is turned on (though you’d have specifically had to turn it off).

If your walls really do have two sides then there is no easy way to do this and you will have to separate your geometry into inside and outside geometry… then just don’t show the outside.

Not sure if it’s what your asking, but my walls are planes (bidemensionals).

That means that if I don’t do something about it, the outer face are not displayed, which is good.

But when I raytrace to position an object, the walls still get in the middle. That’s what I want to avoid.

@jmonillo said: Not sure if it's what your asking, but my walls are planes (bidemensionals).

That means that if I don’t do something about it, the outer face are not displayed, which is good.

But when I raytrace to position an object, the walls still get in the middle. That’s what I want to avoid.

You mean with a ray collision? Just check the normal to see which way it’s facing. If viewDirection.dot( collisionNormal ) is more than 0 then the wall faces away.

Ok, it costed me a pair of searches to understand what you were saying, but I finally was able to do it. Now it works.

Many, many thanks. You have no idea of how complicated and wrong was my code comparing to the simple solution.

Marked topic as solved for you.

Thanks, I don’t know how.

Just change the state in the drop down list on your first post :slight_smile: