Forum rules - please read before posting.

Implementing a scrolling (not panning) camera and slowing/stopping near walls

Hi guys, anyone got any ideas as to how I could implement a camera that follows the player on the x and y axis as required but actually moves along in world space, and doesn't pan?
I am using a mixture of 3d and 2d stuff - kind of like a popup book, and there are a few scenes with a floor that uses the z axis. When a camera pans it distorts the stuff that lies on that axis so I need the camera to pretty much track around instead.
I was planning on having an otherwise stationary camera as a child of my player, but since the movement directions are camera-based it goes berserk.
I played around with a third person camera, which follows the player nicely, except there seems to be no way to constrain it's position on the z axis (obviously since it's designed to follow a player properly)

Also, no matter what I try I can't seem to get the "slow movement near walls" feature working. I've got my character set up with a capsule collider, put box colliders on a layer called "walls" etc, but when I monitor the movement speed variable nothing happens or changes when I bump into walls. I'm using unity complex animations and use the "move speed float" to drive my animations.
If I can't get it working I'll just put a bunch of triggers around the edges and walls instead of colliders. Then have them prevent movement towards them I suppose. Bit of a hassle to set up though!


  • If you're mixing 2D and 3D, what is your Settings Manager's Camera perspective field set to?

    By "panning", you're referring to the GameCamera 2D's "Ken Burns-effect" scrolling, whereby the perspective remains fixed?

    A GameCamera (used by 3D games) can be made to move in only the axes you allow it to. If your scene is in 2D, it won't be availabe in the Scene Manager - but you can still drag it into the scene from /Assets/AdventureCreator/Prefabs/Camera.

    I'm a little confused about the situation, though - so if you need more help with this, it'd be best to see some screenshots to help illustrate the problem.

    Also, no matter what I try I can't seem to get the "slow movement near walls" feature working.

    You've set the Wall collider layer field to match that of your colliders?

    How this feature works does vary a little with the way your character is configured. Again, probably best to see some screens of the character's Inspector and the way your scene is arranged. What are your AC and Unity versions, also?

  • Hi Chris, thanks for the reply. That camera was exactly what I needed. I'll likely see if I can integrate it with cinemachine for some funky effects such as a "look forward" when pressing a particular input etc, but if all else fails it works pretty well.

    With regards the slowdown near walls, it looks as if it isn't functioning too well due to the walk animation thresholds I was using. I'll need to add some more transitional animations and stuff and it should work.
    I use a really weird set up where the character only has left and right animations currently yet you can walk in any direction (since I'm too lazy to get a forwards and backwards animation done at the moment!) and it produces some... Interesting results at present, but after increasing the thresholds at which different animations play, and fiddling with the size of the collider it's working as it should.
    Seems like so far, any issues I've run into have been user error! Your engine really is something else aye! Thanks heaps!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.