This video will help you understand why fast objects go through other objects and how to fix this in Unity3D. Make your object never pass through other objects again. Also, check out this Asset shrinke.me/MyUnityAssets
If objects are still going through other objects in your game even after setting the rigidbody to Continuous Dynamic, then I have finally found a solution after about a year of objects going through walls in my games, it turns out that I made everything in my game WAY to big. Apparently in unity the default 1x1x1 cube is supposed to be 1 cubic meter in size and everything in your game should be realistically sized, I had a problem where the gravity in my game was to low because I made everything way to big, and once I shrunk everything, it increased my games FPS and performance by a lot. The bigger everything in your game, the faster stuff moves which means the easier it is to go through stuff, setting rigidbodys from discrete to continuous dynamic does not make it impossible for stuff to go through other things, it just makes it a lot harder to the point where it appears like it’s impossible, but ridiculously fast things can still go through continuous dynamic rigidbodys, and when everything in your game is way to big, stuff moves a lot faster. Once I started realistically sizing everything in my game, I stopped having collision issues and it also fixed low gravity and performance issues I’ve been having and a lot of people don’t know about this. It took me about a year to find a solution to this problem
Thank JEEBUS for this. I was so very confused why nothing would work. Then I realized I actually sped up my continuous move providers because I was actually traveling a larger distance in order to make the movement speed accurate. If I used the default I would move slowly. But not once I scaled everything down. Thank you. THANK YOU. Thanks.
THANK YOU SO MUCH I WAS LOOKED THROUGH EVERY PLANET, GALAXY, UNIVERSE BUT STILL COULDNT FIND A SOLUTION UNTIL I FOUND THIS THANK YOU, THANK YOU SO MUCH
this still didn't fixed my issue, where my player have tons of mass to eat (around 100 but it eat only some, i have to come back a second time on the mass then it eat the rest, and sometimes my player eat all at once soo i don't understand why), any help is appreciated
Not sure if you will read this, but you want to use a raycast for high speed bullets. Or that is one of the best ways I've found to do it. Calculate where the bullet will be and then shoot a raycast between that distance.
I'm new to game development and i was unable to fix this issue in block breaker game when the ball hits the paddle very fast... I learned a new thing, Thanks! 😃
anyone still having issues as I was. Do this: Time.fixedDeltaTime = Time.timeScale * 0.01f; // Normally multiplied by 0.02 to make 50 checks a second. This doubles the number of times per second the fixedUpdate will run. You can keep decreasing the multiplier to increase number of checks. fixedUpdate is responsible for handling physics updates. Bare in mind if you have a physics heavy game with many physics objects you will see a dramatic reduction in performance so use this wisely at your own risk.
Or if you still have this problem, everything in your game is way to big, make a new cube and use it as size reference because a new cube is 1 meter tall. If everything is way to big than stuff will go through other stuff
thanks for explaining this with such detail. My endless runner game is momentum based, and when jumping/sliding up against the side of the platforms the player would slightly go through the collision box and get stuck hitting the top of the hitbox from underneath. maybe if I just adjust the platforms to be continuous dynamic it would help, been an issue for a long time and feels really bad when this bug ends your highscore run lol
I took another go at the hitboxes and it seems to be better now. I used dynamic rigidbodys instead of kinematic, and edge colliders instead of box colliders. I think the edge colliders was one of the main fixes for me since my player would go into the box collider a little too far and lose speed hitting the inside edges
@@RiHezBestSmiteMontages this is unfortunately an issue that is near impossible to solve due to Unity's using plane based collision instead of polygonal based collision. The surface or angle that the collision detection returns is calculated relative to the moving object, it is not the ACTUAL surface of the collision. Doing so properly requires iterating through a given mesh's polygons (or triangles) and calculating the closest surface.
@@user-og6hl6lv7p the solution is that everything in your game is probably way to big, try to realistically size everything. A standard cube is 1 X 1 X 1 meters tall/wide/deep. Also this will improve performance, make everything realistically sized or smaller. I was stuck for almost like 9 months on this issue and I had to scrap my labyrinth game because I just couldn’t figure out how to fix this problem where stuff goes through other stuff, then I found out my labyrinth was realistically 72 miles long in real life or something like that. The ball was moving way to fast for my colliders to recognize it and that’s why stuff would go through other stuff
Sadly, I still have the issue. I am using unity's terrain, fast moving objects still tunnel through it. Does anyone have a solution to that? Thanks for this tutorial also, it is really good
You forgot to note that this does take up more resources so only use this only if this is completely necessary (like if this is essential to the gameplay). Overall, great video and something that I find useful.
This just helped me fix my problem. But then I realized I have already given this video a like ... I really need to fix my brain and not forget everything ^^
Hi! I'n my case it's a similar scenario, except the wall also moves towards the other objcet at the same time (in my case a ball with a sphere collider). I lready changed all the options, (continuous/dynamic continuous) and so on, but the moving the colliding ball still goes throuth the moving wall. Is there anything I can do to prevent that from happening?
I had this same problem where changing it to Continuous Dynamic would only make it a little bit harder for objects to go through walls but everything would still go through walls if moving fast enough and I think after about a year I have found the solution. It turns out that whenever I made a game, everything in my game was waaaay to big, like I made a labyrinth game and the ball kept falling through the ground when tilting it. Then I found out that in unity, the default 1x1x1 cube is 1 cubic meter in size, and everything should be realistically sized. The way collisions work is that the game constantly asks colliders if something is colliding with them. When rigidbodys are set to “discrete”, the game asks less often, I’m not sure but let’s say 20 times a second or once every 1.5 frames, and when it’s set to continuous dynamic, it asks 60 times a second, and when something is moving extreamly fast, like ridiculously fast where you can’t see it moving, it will pass through the collider before it has time to update, so if you make everything in your game way to big, then stuff will be moving a lot faster, and will be able to go through walls easier, I used to make everything in my games way to big and I had problems with low FPS, objects would fall slow like there was no gravity, and stuff would go through other stuff, so you might have to shrink everything in your game to a realistic real life size and that will increase the gravity strength of your game but you can always change the gravity of your game in the settings or create your own gravity. And you can use a default cube as reference because they are 1 meter tall. I started doing this to all of my games now and I no longer have this issue at all. It took me about a year to finally figure this out
when player is move and wall is rotate along with y axis so player have to be stop. Can you tell me how rigidbodies function will have to be set ?? for both player and wall....
What? I may be able to help but I don’t understand, please retype it better. I think the answer is both should be set to Continuous Dynamic if they are both moving, but if you are saying that when your player walks into a wall on an angle, they spin on the Y axis, I had this problem and you have to change the 2 drag options up, the first one is for how much friction the rigidbodys has and the other is for how much friction when it’s rotating, change the rotating one up a lot and it should stop doing that. And if you stop falling when jumping or falling into a wall, the solution to that is that you have to right click in the assets area and got to “create” and then go to Physic Material, then set the friction of the material to 0, then go to the object that you are getting stuck on (or every wall in your game) and set the material to the new physic material you just created
even after using this solution, it is not getting fixed for me. pls help (im replicating, rocket league so my car tries to hit the ball but it passes through the ball . ive not set the collider as a trigger and changed collision detection too but the problem still exists.)
Every game I’ve ever made still has this problem, stuff keeps going through other stuff, the player can run through walls. I’ve tried every combination of continuous, continuous dynamic, continuous speculative, discrete, and I tried adding and removing ridged bodies and turning on and off static and nothing is working, I even just got a new computer and I just started making a new game and I still have this issue and I have continuous on but my player still goes through walls when I run, please help. I’ve tried everything
I think I actually figured out a solution if continuous dynamic still doesn’t work, I think either everything in your game might be too big so that whenever something is moving, it’s moving way faster than you think, try making everything in your game smaller, use a standard 1x1x1 cube as reference and think of it as being 1 meter tall
Is there a reason why my Unity project won't let me change the Collision Detection mode to continuous dynamic? Every time I try to set the obstacle Collision Detection to continuous dynamic it automatically sets it to continuous speculative
You probably have "Is Kinematic" checked. As the Unity documentation states: "Continuous speculative: [...] This is also the only CCD mode that you can set kinematic bodies. [...]".
@@M-Cube_ yeah i figured yt was that at the time of commenting. But even after the video suggestion the collision was inconsistent. I had to increase the size of the box collider
@@theonlyreega I finally found a solution after about a year of objects going through walls in my game, it turns out that I made everything in my game WAY to big. Apparently in unity the default 1x1x1 cube is supposed to be 1 cubic meter in size and everything in your game should be realistically sized, I had a problem where the gravity in my game was to low because I made everything way to big, and once I shrunk everything, it increased my games FPS and performance by a lot. The bigger everything in your game, the faster stuff moves which means the easier it is to go through stuff, setting rigidbodys from discrete to continuous dynamic does not make it impossible for stuff to go through other things, it just makes it a lot harder to the point where it appears like it’s impossible, but ridiculously fast things can still go through continuous dynamic rigidbodys, and when everything in your game is way to big, stuff moves a lot faster. Once I started realistically sizing everything in my game, I stopped having collision issues and it also fixed low gravity and performance issues I’ve been having and a lot of people don’t know about this. It took me about a year to find a solution to this problem
I have a problem, I am developping a 2D top down game in which I have a bomb. If the GameObject is between the bomb and a wall from a tilemap (which has Tilemap Collider 2D, Rigidbody 2D (static body type) and a Composite Collider 2D) and that the bomb explodes, the slime will go through the wall even if its collision detection is in continuous. I tried to make the rigidbody2d of the wall to kinematic and collision detection to continuous but it didn't change anything. It's a big problem as to go to the next room, the player must kill all enemies....
Unfortunately this setup does not work for the arrows in my game. The issue being that in one frame, the arrow is on one side of the enemy, then in the next frame, the arrow is on the opposite side of the enemy. So there are no frames where the 2 objects collide. This only happens when you're at very specific distances from the enemies. I would wager that if you moved the cube backward in this video's example by half a cube width, it would go right through the rigidbody wall.
I finally found a solution after about a year of objects going through walls in my game, it turns out that I made everything in my game WAY to big. Apparently in unity the default 1x1x1 cube is supposed to be 1 cubic meter in size and everything in your game should be realistically sized, I had a problem where the gravity in my game was to low because I made everything way to big, and once I shrunk everything, it increased my games FPS and performance by a lot. The bigger everything in your game, the faster stuff moves which means the easier it is to go through stuff, setting rigidbodys from discrete to continuous dynamic does not make it impossible for stuff to go through other things, it just makes it a lot harder to the point where it appears like it’s impossible, but ridiculously fast things can still go through continuous dynamic rigidbodys, and when everything in your game is way to big, stuff moves a lot faster. Once I started realistically sizing everything in my game, I stopped having collision issues and it also fixed low gravity and performance issues I’ve been having and a lot of people don’t know about this. It took me about a year to find a solution to this problem
Someone from unity technology said you should use rigibody to move the object. when i used transform to move the object It wasn't working for me, but it looks fine with rb.addforce
@@srijangupta3234 I finally found a solution after about a year of objects going through walls in my game, it turns out that I made everything in my game WAY to big. Apparently in unity the default 1x1x1 cube is supposed to be 1 cubic meter in size and everything in your game should be realistically sized, I had a problem where the gravity in my game was to low because I made everything way to big, and once I shrunk everything, it increased my games FPS and performance by a lot. The bigger everything in your game, the faster stuff moves which means the easier it is to go through stuff, setting rigidbodys from discrete to continuous dynamic does not make it impossible for stuff to go through other things, it just makes it a lot harder to the point where it appears like it’s impossible, but ridiculously fast things can still go through continuous dynamic rigidbodys, and when everything in your game is way to big, stuff moves a lot faster. Once I started realistically sizing everything in my game, I stopped having collision issues and it also fixed low gravity and performance issues I’ve been having and a lot of people don’t know about this. It took me about a year to find a solution to this problem
Bullets are still clipping through other players, despite me following all directions in this video (the bullet is even travelling at a slower speed than the cube shown). What more should I do?
Might be something with the other players, like maybe they are using character controllers instead of rigidbody. Or if they have both character controller and rigidbody conflict. Never use both. Try checking the collision detecting refresh rate.
@@OnlineCodeCoaching Hello, I happen to be using OnTriggerEnter on the bullets, rigidbodies on the players with the same colliders and continuous collision detection. Maybe it's the scale of the bullets? But I don't want to make them too large. Thanks though.
I finally found a solution after about a year of objects going through walls in my game, it turns out that I made everything in my game WAY to big. Apparently in unity the default 1x1x1 cube is supposed to be 1 cubic meter in size and everything in your game should be realistically sized, I had a problem where the gravity in my game was to low because I made everything way to big, and once I shrunk everything, it increased my games FPS and performance by a lot. The bigger everything in your game, the faster stuff moves which means the easier it is to go through stuff, setting rigidbodys from discrete to continuous dynamic does not make it impossible for stuff to go through other things, it just makes it a lot harder to the point where it appears like it’s impossible, but ridiculously fast things can still go through continuous dynamic rigidbodys, and when everything in your game is way to big, stuff moves a lot faster. Once I started realistically sizing everything in my game, I stopped having collision issues and it also fixed low gravity and performance issues I’ve been having and a lot of people don’t know about this. It took me about a year to find a solution to this problem
Go to assets the assets area and right click, go to create > Physic Material, then set bounciness to 0, then go to the collider of your bullet and go to “Material” for that collider and set the material to the new Physic Material you just made, also if that doesn’t work, you may also have to add the Physic Material to your walls. Also if your having a problem where you stick to walls when jumping into them instead of falling, you have to do this but turn the friction to 0 on your physic material