Room camera


I’ve been trying to come up with a way to make the camera stop at walls of rooms. Maybe I’m overcomplicating things, but would raycast be able to measure a room? Actually, maybe raycast can be used to detect an invisible block type that tells the camera to not go past that spot, or should I use proximity instead?

Has anyone come up with a simpler way?
It has to be flexible to any room size or shape, not like Persecution was limited to Zelda sized screens. Once we get a working room cam, we can archive it and share it as a bundle tool.

I’ll try some stuff out later in the day. I might work on that instead of submitting something for the competition.

Okay, so Latif3 thought a good way to measure distance would be to use the Pythagorean theorem, nkw, Im not sure how to do this, because I know

The players/ targets position is going to be their own respective coordinates, but the part where the two axes would be the bottom left/top right corner of the triangle depending on how you order the X and Y axis. Then you square them, add em up, and sqrt them

Now, ray-cast way would/should be less complicated but more limited.

in an object thats NOT the player, if its for the player have the player attach it.

Use an ease, and connect a 0 to from and the max distance desired to to

Have a proximity trigger the two numbers, because then it wont trigger unless its in range.

Back to ease: out sets a number, and sets/triggers the ray, if the ray hits, it triggers that first mentioned number. The number then goes to whatever, because that is your distance.

If you dont want to use ease, try using a repeater and a expression, and I can explain the rest layer, my fingers are tired of typing and I have FSAs today. Fun

I was thinking more along the lines of this:

Let’s say the screen is 15x11

A centered player would be at 8,6 with raycast beaming left/right 7 blocks and up/down 5 blocks. If there is an invisible camera block in range, the camera stops at that position, but can still move the other directions.

Like let’s say you have a ceiling, and when you jump, the camera won’t go up, but if there’s a hole in the ceiling, the camera will go up when you jump.

I’m not a math guy, and I don’t know much about raycast. This is just an idea I’ll have to test tonight.

Raycast just draws an invisible line in a given direction, and if it strikes a certain object it triggers a hit, but if not it triggers a miss

I imagine you can just use a filter, and since you left, filters can be adjusted in game now, so just have a level specific object send the borders to the object.

I was thinking more like something where it’s setting the camera to the player coordinates with equations to adjust height and center it, using always for coordinates, then if raycast pings a wall, a xor or something trips the always until you walk away from that wall, so the camera stops moving until raycast isn’t tripping, assuming raycast goes through objects.


The camera wall concept works fine with raycast, but realistically I wouldn’t place real blocks as borders, but as invisible camera blocks in any area I don’t want the camera to scroll past. The main issue I have is that raycast can’t see through walls. @grazer could you make a checkmark for raycast to be passable? Notice when you fly near gray blocks, the camera breaks. The camera also breaks if the AntiCam blocks are not solid, but have collision. Proximity didn’t work since it uses a bubble, and any part of the bubble triggers x or y, which is why raycast is superior for precision. Raycast just needs an option to see through walls, and this room cam will be nearly perfect after some coordinate position tweaking.

Alright, I’m out of ideas. Unless @grazer does a raycast update, there will never be an easy way to do Metroid or rpg area room cameras.