Hide Walls and Roof for an RPG. Simple, No python

Use WASD to control the cube.
Enter the house, and voila! You can see inside the house!
Rotate camera.
Made with Blender 2.78 (version b, I think).

No python. Game logic only.

A bit crude-looking, though?

How it works:
For each house, you make a slightly bigger duplicate with its normals flipped.
Make the smaller house sensor physics with box collision bounds.
Make it invisible when your character touches it. Make it visible when your character leaves.

Make the slightly bigger house with static physics and UN-check collision bounds.
This will keep the character from walking through its walls. Use the door!

Oh, and the cube has a collision property: hideWall.

It’s not perfect, but I’m happy I figured it out!

Note: I don’t think it’ll work well for multi-player versus games.

  • Sdhy.

P.S. Another house sort of blocks your view… Hmm… To be continued.

Attachments



HideRoofAndWallsForRPG.blend (937 KB)

That’s actually a really nice idea. Most rpgs I’ve played just remove the roof, but the walls can still sometimes hide the player. As for interference from other buildings, you might have to organize the buildings with this in mind. As long as you can see the player from most angles, it should be fine.

Great idea actually, I’ve been trying to do this for a long time and now you’ve just crack it xb

Yes! I posted something useful!

@APilch
Yeah, organizing buildings will be necessary.

I did see a .blend on these forums,
that uses python.
I wonder if that hides all objects in between the character and camera?
(Though I haven’t learned python.)

I think two-storey buildings is possible, too.

You could try this: Give each building 2 object color key frames (frame 1: 100% opacity, frame 2: 25 - 50% opacity). Have them at frame 1 always and create an invisible ghost object with property ‘view’ from the player to the camera. On the building’s logic use if collision with property ‘view’ set building animation to frame 2.

In this way, the ‘view’ object will act as a ray that the buildings can detect and react with.

Let me know if I did a poor job explaining and I will make a demo.

Hi APilch,
Do you mean e.g. make a long, invisible pole from the camera to the player?
And then anything that touches this pole is in the way of the camera, and thus, make it invisible?
If so, let me know if it works in practice,
cuz I tried it, but it didn’t work.
Maybe cuz I need to learn how physics types work, etc.

I guess you are right about the object being collided with needing to be a sensor. I don’t remember it ever being like that… but that does solve a hit box problem I was trying to fix with my last BGMC game.

I made a demo of what I was trying to explain. The blue and orange cubes are the buildings. When they collide with the invisible pole they go to the second frame of their object color animation (50% opacity). Then they change back when there is no collision.

Blend file: https://www.dropbox.com/s/8vj5ukw1bw9jmng/SeeThroughBuildings.blend?dl=0

here is a alternative way of doing it , still pure logic brick setup.
uses object color alpha to make the roof invisible.


and here is the blend

http://15b.dk/blendfiles/rpg-iso-style.blend