Hi! I'm brand new to Adventure Creator and just starting to mess around with the basics a few days ago. I figured out how to make a character walk only within a NavMesh using "Direct" Movement method (arrows or WASD), but what I'd really like is a single path NavMesh. Like a sidescrolling platformer but without any jumping or gravity: I just want the character stuck to the ground.
I tried constraining the NavMesh to a very very narrow area, but the character could still move slightly up and down and it looked strange having that little bit of wiggle. I saw "Path" in the "Navigation" section of AC Game Editor, which I thought might be what I was looking for but it seems to be only for NPCs and other elements to just follow along, not for the player (or am I wrong there?)
I also tried a version with gravity turned on, but then the character would still "jump" a bit if I pressed Up, they would still slide down inclines. I think this version could be promising if I could add friction to those inclines. For collision I've been using both a "Circle Collider 2D" and "Rigidbody 2D" component on my character. There's also a "Character Controller" component that looked better because it has more features like a walkable angle, but I couldn't get it to react to any Collision Cubes, Box Colliders, or NavMesh for some reason.
And I apologize if I don't know any correct terminology or names, being brand new to both AC and Unity in general. Any help would great thanks!
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Welcome to the community, @Sc00.
To be clear: restricting a Direct-controlled Player the NavMesh is only a convenience tool, rather than a necessity. A NavMesh is only strictly necessary if characters rely on pathfinding in the scene - which Direct movement doesn't involve.
To limit a Direct-controller Player to just left and right, run the Player: Constrain Action in your scene's "OnStart" cutscene. Here, you can set the Up and Down movement fields to "Disabled" to prevent movement in those directions.
If the character move up or down while turning, you can prevent this by going to the "Movement" section of the Settings Manager, and setting the Turning mode to Snap.
Without a NavMesh to restrict them to, however, you will need to rely on 2D colliders to mark the left and right boundaries for the Player - who themselves will need to have a Rigidbody 2D and Circle Collider 2D.
The Character Controller component is a built-in Unity component - which AC is compatible with - however, it is only for use in 3D.
Thanks so much for the reply! That's definitely a great start. I guess I should be looking more at the "OnStart" actions for setting scene parameters. Where else can I use action parameters other than in the "Cutscenes" section?
I also see it has a Player: Lock to Path action, which I think might be exactly what I wanted. I still wanted to be able to use the Up and Down arrows, just not deviate from that path at all (Like the map navigation screen in Kentucky Route Zero, if you're familiar with that, with the player's car being constrained exclusively to the road lines but can still use all 4 directions). Although one issue I now see with this is that the player can escape the bounds of the path once they reach one end or the other. I'll try to figure out a way to block that but I think this is a good start. Thanks again!
Actions can be run in a number of ways - the panel in the Scene Manager just being the most convenient. They can also be run from Triggers, other ActionLists, Events, and the "ActionList Starter" component.
The Player: Constrain Action was originally inspired by the "Walking Dead" games, where you'd sometimes have a sequence where the Player is free to move along a set path, but can't go off it.
It does sound similar to what you're describing, though - as this is a visual issue - if may be best to see a mockup/screenshot of your situation to best understand the specifics.
The Player does indeed currently escape the Path when reaching the ends. I should like to see if this behaviour can be made optional - thanks for raising it. In the meantime, placing colliders down over the ends ought to block them - provided the Player has a Rigidbody2D / CircleCollider2D pairing of their own.
Surprisingly, colliders didn't seem to work. They do indeed block the player, but for some reason encountering the obstacle also derails them from the path. Not sure why exactly.
However, I did find a different solution (for now at least, fingers crossed!) by placing down trigger zones that constrain the player from moving any direction except for back towards the path and then a second trigger zone immediately after it to reactivate all movement options.
Side question related to this setup I configured: are all trigger effects permanent unless changed by a new trigger? I was wondering if there's a setting to make the trigger effects temporary: only valid while the player is within it's zone and then those changes revert back after leaving the zone?
A Trigger is just a means to run Actions when intersected with - it's independent of the actual Actions it runs.
If you want to have another set of Actions to "undo" its effects when the Player leaves it, attach another AC_Trigger component to it and set its Trigger reacts to On Exit. The Actions you then define will run when the Player leaves the same boundary as the "On Enter" one.
However, I have been looking into the constraint issue - and can confirm that the Player will stop leaving the Path upon reaching its ends as part of the next update.
Good idea. "On Exit" prompt to change it back worked great! Thanks.
Maybe getting off topic of my initial question, but with regards to "direct" movement interactivity selected in the settings, how can you make other key inputs perform actions?
I went down a bit of a tutorial rabbit hole on key inputs, creating action lists, input managers, and it was all quickly getting confusing and overly complicated. I just want to be able to make pressing keys on the keyboard perform actions like you can with hotspots in the "point and click" movement method. Such as: m to bring up the menu, i to bring up the inventory, etc. Or is there a way to have both point and click hotspots while also having "direct" player movement?
AC separates the input used for movement and Hotspot interactions: even with Direct movement, which relies on a keyboard for input, you can still use the mouse to interact with Hotspots - just set the Input method to Keyboard And Controller.
If this is already the case and you're not getting the intended behaviour, can you describe exactly what you're getting vs what you'd like?
When it comes to showing Menus via keyboard inputs, there are two ways to do it:
Oh nice. That's working through the Input Manager. I'm still not able to click any hotspots though, but upon changing the Movement Method back to Point and Click, my hotspots aren't working there either so I seam to have broken them somewhere else along the lines. Not sure what I did there but I'll keep digging around.
Thanks for all your help! Really enjoying the functionality of Adventure Creator so far. My only previous "game dev" experience is making some Dreams games (although they had some fairly complex logic I programmed from scratch) so this is easing me in nicely to "real" game development.
Nice, that's good to hear.
If you'd like an extra set of eyes, share screenshots of your Settings Manager and I'll try to spot what might be wrong.