[solved] Camera Dolly

Rimrook

  • Posts: 251
So my camera is attached to an actor, named 'dolly' (after the carts that hold cameras in Hollywood) and as this dolly moves around, it will collide with other actors designed to block it. This basically keeps the camera focused on the playable area like we see in Metroid, Mega Man, and many other platdormers. Seems simple right?

The fundamental issue is the physics and what shape the dolly has. If it's square, it snags and stops on everything. The best is a circle in the center but it leaves an undesirable spacing on the sides. The middle ground is two circles that overlap to cover the screen's dimensions with a pill shape. This is ALMOST perfect, flawed in only the fact that the pill shape still has a flat side on the top and bottom. This snags if the player takes a sharp corner, but is fine after the corner gets to the round part of the pill shape.

My theorized solution is to have the dolly somehow slide out of the way somehow when the flat side gets snagged. Either physically or offsetting the camera's position on the dolly. I can't seem to reliably make that happen.

Anyone who wants to try it, I can post the code, it's surprisingly simple. Plus I believe it would be a valuable behavior to have around once this last challenge is overcome.

I welcome any and all suggestions, thoughts, and ideas here.

« Last Edit: July 29, 2017, 06:01:06 am by Rimrook »

LIBERADO

  • *
  • Posts: 2720
Create a custom octagonal shape:

« Last Edit: July 25, 2017, 05:28:34 pm by LIBERADO »
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

Rimrook

  • Posts: 251
I actually tried that, though my screen resolution is 576 x 320 so it was more elliptical. It still got stuck.
Shame I can't make an actual elliptical shape.

For some reason, polygons get stuck if the space they go into is the exact width, but a circle of the same width will slide in without a problem.

Rimrook

  • Posts: 251
Kinda solved this in a dumb way.

When the player is a certain distance from the center of the dolly, the collision shape shrinks to accommodate navigating to the player with ease. It's actually rather good now.  Another solution would be to tie the dolly to some A* Pathfinding but that's excessive just for a smooth moving camera actor.