Forum rules - please read before posting.

Strange issue when change to direct input method

Hi everyone,
AC 1.70.0 + Unity 2019.2.17f1 on a 2d game.

I'm writing a script to change the input method to "mouse and keybord" to "Keyboard or controller" when you click a controller button or when you click a mouse button. When I change to controller, I'd like my character moves with the analogical input and so I change the movement method from Point And Click to Direct.

Now I know that with this method Navmeshes don't work, so in my scene I improve also the collision cube 2d (so, when the game is in point and click it uses navmeshes, otherwise, with controller, it uses the collision cube 2d). My issue is it seems not to see the collision cube and the player can move through all the room and beyond (he can exit from the camera).

I checked these parameters:

  • collision cubes with "Is trigger" unchecked
  • My player has Rigidbody 2d and Circle Collider 2d (with "Is Trigger" unchecked") in the root
  • Camera perspective in Camera setting is set on 2D
  • In Scene settings menu, pathfinding method is set to Polygon Collider

I can't understand where's the problem. I try also to put a single collision cube in the right of the room, as test, but the player can go through, like it was not recognize.

Comments

  • Strange indeed. If all the colliders involved are 2D, and the Rigidbody isn't marked as "Kinematic", then the Player should be blocked by collisions.

    As things are more complicated with your script to change various fields, let's focus on getting things right with just Direct control first.

    AC still relies on Unity for its physics behaviour, so it would be worth checking your Physics settings to make sure you don't have any layers set up to ignore collisions.

    Otherwise, let's see some screenshots of the Player's Inspector, the scene, and a typical collider's Inspector. Bear in mind that the "Collision cube 2D" listing in the Scene Manager is only a convenience - a regular empty GameObject with a Box / Polygon Collider 2D component should work also.

  • Thanks Chris, the Rigidbody 2d of the player was set in kinematic. Now I set it on Dynamic, with Simulated checked (and I checked also Ignore Gravity, otherwise my player falls down). Now seems to work correctly. I'll make other test, thank you.

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.