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.
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.
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
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
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
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
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
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! 😃
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 ^^
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
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
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
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.
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
If someone still has issues with collisions going through in a weird way, check the movement code, if u directly set the Rigidbody position via MovePosition there will be issues, rb.velocity makes so walls etc becomes brickwalls, unpassable :)
I had an issue where an obstacle went through the player, they collided slightly but i wanted the player to get bumped away by the obstacle or carried along by the obstacle but all that happened was the obstacle would touch the player, alter its direction a little bit then just go through the whole player. to fix it I went to edit >project settings >Physics >Default max depenetration velocity - set to a very high number (10000000) and i have no clue how it works but it did for me
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
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
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.
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.)
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....
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
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
If you want to make something bounce off the wall without losing speed, you can go to the assets are of unity, right click and go to create > physic material, then you can set the friction to lower or you can add bounciness, then name the physic material something. Then go to the wall and go down to the collider and set the material to whatever the physic material you just made, you can also change the friction to zero and use it in a FPS or open word game if you player keeps getting stuck when jumping or falling into walls
Even if its simple, its one of the best explained and clearly illustrated clip about collision with fast objects and walls. Thank you!
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
Thanks it worked!♥
But what when we have to create big objects???
thank you 🧡
Well damn that explains a lot but also kind of makes everything a lot harder for no good reason...
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.
i face this issue while making my sniper game,bullets didnt hit the enemy, nice point.
I have this issue too, but this tutorial helped me a lot!!!
Exact same situation here. 😁
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.
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
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
Excellent. Very simple and well illustrated.
Thank you! This was exactly what i was searching for! :)
thank you man, you saved my sanity
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
use raycast or spherecast detection most stable way to calculate fast projectiles
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
Are You using transform.translate or Add Force
Why does the cube only need continuous and not continuous dynamic like the wall?
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
Awesome, thanks a lot mate, this was starting to drive me crazy, because the tips in this video did not fix my problem, your line saved me.
You could also try extending the collider bounds in the direction of the player/objects velocity to predict collisions for greater accuracy.
This is a really nifty tip man. You could even have it be extended at a greater distance given a greater velocity and such
But then you might have this weird floating bounty around.
Thank you so much, I didn't know that it was gonna be this simple, I thought that I was going to have to do some raycast collision stuff!
Seriously thank you so much. This was exactly what I needed to fix my problem. I really appreciate this video you've made for us. Thank you very much.
No more headaches . Thanks !
But, I already have set it to continuous and that still happens. Plus, I tried all other options...
Any idea how to fix it
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
@@tekae6949 Thanks,
I'll look into it..
@@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
@@DARK_AMBIGUOUS thanks mate...
Even though it's been 4 months but this helped..
Thanks fren !! You make my day
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! 😃
Im super new to Unity and this fixed my whole game (lol). Thank you very much. Good video
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.
simple, explanatory, and quick tysm
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 ^^
Glad this exists, Thank you very much
3 month in this problem, and this F*** awesome video save my project!!
it seems like the object is still going through the walls with the continuous detection, though with very little struggle.
Have you figured it out yet?
Any solution?
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
@@DARK_AMBIGUOUS thats not the reason. i got realistic proportions and objects still go through things
@@DARK_AMBIGUOUS nice, thanks for that
Now I am finally seeing the solution of the most annoying problem I faced in unity when I am now switched to unreal engine haha.
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
I actually love you for this
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
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.
Tem a diferença entre a movimentação do objeto em si e dá movimentação por teleporte, algo do tipo Transform e Translate
Thank you very much! The tutorial was simple and very easy to understand.
OMG I NEVER THOUGH I CANT BE SOLVE SO EASILY, THANKS A LOT
I knew I would learn sth from RUclips. Thank u so much.
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
Thank you! This helped a ton!
Wow ty this was super helpful!
Thank You, very simple and works perfectly.
It's not working when the terrain has mountains . If the body collides with them, it penetrates the mountain and fall
Hi. Have you found a fix when this is happening on terrain?
If someone still has issues with collisions going through in a weird way, check the movement code, if u directly set the Rigidbody position via MovePosition there will be issues, rb.velocity makes so walls etc becomes brickwalls, unpassable :)
How much does this impact performance?
It depends on your computers specs, it shouldn’t be that much, you’ll have to try it out and see
I had an issue where an obstacle went through the player, they collided slightly but i wanted the player to get bumped away by the obstacle or carried along by the obstacle but all that happened was the obstacle would touch the player, alter its direction a little bit then just go through the whole player. to fix it I went to edit >project settings >Physics >Default max depenetration velocity - set to a very high number (10000000) and i have no clue how it works but it did for me
in Unity 2D, rigidbody 2D hasn't got Continuous Dynamic.I need this.
Because very fast moving objects pass through each other. How can i fix it?
Maybe a shorter fixed update timestep? But that will have performance implications if you have a lot of objects
Thanks so much. I was having trouble getting my moving players to detect fast moving bullets.
thank you for best example
Thank you so much, sir. This was really helpful
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
strang question can i see the ad force script
Thank you! This was easy for me to fix!
Thanks, I was doing all sorts of things to try and fix this...
thank you, very useful
how about Mesh Collider? When ball with sphere collider and rigidbody still go through objects with MeshCollider
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
this is useful. thank you so much!
You helped me a lot! Thank you! :)
thank you i was looking for somethink like that
Thank you this really helped me
Thanks a lot bro ❤️
Wow thanks!!! Love you more than chaGPT!
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.
docs.unity3d.com/Manual/ContinuousCollisionDetection.html
If all fails, use ontriggerenter instead. It has a much faster and reliable detection.
@@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.
Thanks!
Thank you so much dude. Thank you.
Wow thanks. This helped.
Thanks A Lot You Are Seriously life saver
Thanks! much helpful. very clear. such simple. wow
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.)
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....
have you found a solution?
you're a lifesaver man
Thank you very much.
how to do this in 2d
I have the problem that my bullets bounce off walls
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
@@DARK_AMBIGUOUS I had to make a script were if it collides with anything then it deletes the bullet and that's worked
broooo are u joking how is it that simple wow thanks man
i love you thank you again
Best and clear
Nice!!!!! Thank you so much!!!!
Same problem but on trigger enter delay due to too fast bullet
Are you still having this problem? If you are, then I have a solution
No
Thanks a lot!
Thank you!
THANK U SO MUCH!
thank you so much!!!
thank you so much
This didn't work with my Rigidbody.MovePosition type player controller.
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
Very common bug which trips up a lot of people.
Awesome vid dude
But my issue is still there
thanks for this video
Thank you
Thanks dude
best tutorial
Thank you!!!!!!!!!!!!!!!!
This is how Quantum work
Thankx
ty so much
It's not working
same :(
Thx
work is good but object speed automatically decrease
If you want to make something bounce off the wall without losing speed, you can go to the assets are of unity, right click and go to create > physic material, then you can set the friction to lower or you can add bounciness, then name the physic material something. Then go to the wall and go down to the collider and set the material to whatever the physic material you just made, you can also change the friction to zero and use it in a FPS or open word game if you player keeps getting stuck when jumping or falling into walls
helpfull :3 thanks bother! xD
THHXXX
ty
good
Cool
TYSM OMG