Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+1)

To address the issue of objects going through walls and off the map in Unity, there are several steps your friend can take to resolve this problem:

  1. Use Continuous Collision Detection: When objects move very quickly, Unity can sometimes miss collisions, causing them to pass through walls. Switching the Rigidbody's collision detection mode from "Discrete" to "Continuous" can help ensure collisions are detected more accurately. This is especially useful for fast-moving objects.
  2. Avoid Directly Modifying Transform: Instead of modifying the object's transform position directly, use Rigidbody methods like MovePosition or AddForce. Directly modifying the transform can cause the object to "teleport" past colliders. Using Rigidbody methods ensures that physics calculations are taken into account.
  3. Increase Physics Timesteps: Ensure that physics updates are frequent enough to catch all collisions. This can be done by adjusting the Fixed Timestep in the Time settings of Unity's project settings. A smaller timestep means more frequent physics updates, which can help with collision detection.
  4. Adjust Depenetration Settings: Increasing the maximum depenetration velocity in Unity’s Physics settings can help with objects getting stuck or passing through other objects. This setting controls how quickly Unity resolves collisions when objects penetrate each other.
  5. Ensure Proper Collider Setup: Make sure that the objects have appropriate colliders attached. For example, if the object is spherical, use a Sphere Collider. Ensure that colliders are not set as triggers unless specifically needed for trigger events, as triggers do not detect collisions in the same way as regular colliders.
  6. Layer and Physics Interaction Settings: Verify that the objects and walls are on layers that are set to interact correctly in the Physics settings. Misconfigured layer interactions can result in missed collisions.

By implementing these fixes, your friend should see a significant improvement in how the objects behave in the game, reducing or eliminating the issue of objects passing through walls and falling off the map.

(+1)(-2)

I asked GPT.

(+1)

yeah it's not like I don't know how, but it requires much time and I don't feel like it :)
P.S: Bou 2 won't have this issue get excited ;)