0
\$\begingroup\$

So, I have some platform with colliders and a character with a collider (everything in 2D). The problem is, while there is some noticeable effects (a certain push back) when the colliders collide, they actually intersect each other and can go through each other.. How can I actually put a collider that doesn't let anything pass, it just stands there like a brick wall against anything?

By the way, any enlightenment on the inner workings of the colliders behavior will be appreciative as I cannot understand how this could even happen.

Demonstration video

Demonstration video 2

Bellow I have the images showing the inspector of both the character and platforms/wall respectively.

Player Inspector[![Wall Inspector]4

Also: I'm moving the character using transform.position += Vector3.right * speed * Time.deltaTime;

\$\endgroup\$
7
  • \$\begingroup\$ I'm not able to view your videos at your provided links. Please also show us how you're moving these objects. A common mistake is to move the objects with the Transform component, bypassing the physics engine that's responsible for resolving collisions. \$\endgroup\$
    – DMGregory
    May 20, 2020 at 15:17
  • \$\begingroup\$ I have replaced them with working links \$\endgroup\$
    – ManoTech
    May 20, 2020 at 15:32
  • \$\begingroup\$ Don't forget to include the information requested about how you're moving your objects! Be sure to also show us how you've set up their colliders, rigidbodies, etc. in the Inspector. A good guideline is that your question should contain all the information we need to reproduce your problem if we start from a new, empty project and can't ask you any follow-up questions. That means there's absolutely no obstacles to verifying the source of the problem and testing solutions, helping you get proven answers quickly. \$\endgroup\$
    – DMGregory
    May 20, 2020 at 15:41
  • \$\begingroup\$ Thanks for the heads up! \$\endgroup\$
    – ManoTech
    May 20, 2020 at 16:13
  • \$\begingroup\$ Yep, there's your problem: transform.position += ... says "forget physics, just go to this exact position, no matter what colliders might be in the way". If you want to respect physics influences like collisions, you need to use the Rigidbody2D to process your movement, not the Transform. \$\endgroup\$
    – DMGregory
    May 20, 2020 at 16:26

0

Browse other questions tagged .