So I’ve looked back through the video a bunch of times and I’m probably just missing something, but I seriously don’t know what.
The only thing I can think of that I did differently than the video is that the 2D Rigidbody component doesn’t have an Is Kinematic checkbox. Instead, it’s a dropdown menu with three options: Dynamic, Kinematic, and Static. I don’t know why this should act any differently. Below are screenshots of the Inspector views for my Ball and Paddle objects. I tried putting a script on the Paddle object to try to detect a collision, and it seems like one is not even being detected.
Please let me know what is wrong with my setup. I’m really enjoying the course so far. I’m pretty new to Unity, and before this I was just stumbling my way through. I love how precise the videos are, and this is the first roadblock I’ve come up against. I’m trying to develop for VR, so these fundamentals are extremely important for me to nail down!
Thanks for reading.
P.S. If anything in my questions is unclear, or if I should add more information, please don’t hesitate to let me know.
Hello @laptsirhc, nice to see you around here, I’m happy to know that you are liking it so far!
Your Ball’s Circle Collider 2D has been marked as Trigger. Triggers don’t use their rigidbody to calculate the collision, they just identify the collision, if you unmark the trigger checkbox it should start working as expected.
Another thing: The Collision Detection Mode has been settled to Discrete, you will probably want to change it to Continuous in this case. The engine will check only once per frame for discrete collision, continuous collisions are identified even when they happen between frames.
Yeah… I was going to use my excessive tiredness as an excuse, but I won’t!
I edited my post with regards to the collision detection, the ball tends to move around a lot more than the paddle and will be bouncing off of many objects, makes sense for that to be on continuous. I don’t really think the paddle needs that level of detection though. May depend on the level design, if there were a lot of blocks close to the paddle causing the ball to bounce back and forth really quickly then, well, maybe, but I think it’s an overhead you can manage with out. Play testing would be the key.
@Joao_Dalvi@Rob
Thank you! I unchecked the Is Trigger option on the Ball object, and changed its Collision Detection to Continuous. Worked like a charm.
Only thing is, after unchecking the Is Trigger box, the ball no longer went to the next scene when it missed the paddle and hit the Lose Collider. I knew why: it just wasn’t detecting the Trigger. But it was detected the collision, so I just moved the line
levelManager.LoadLevel(“Win”);
from the OnTriggerEnter2D method to the OnCollisionEnter2D method. So I no longer have a problem. However, I don’t remember Ben changing this in the tutorial, so I’m wondering how it worked for him? If Is Trigger is unchecked, why would the OnTriggerEnter2D message ever be intercepted? Perhaps he did change it.
Well done for spotting that. I thought he had the levelManager.LoadLevel("Win"); statement within both methods, but I am having to dig deep in my memory here…
Yeah, I agree! I don’t think that the paddle’s detection mode should be continuos either. If there were something moving really really fast the best option would be to having the Dynamic collision imo, I had some problems detecting collisions where the cannon ball was passing through the terrain even with continuous collision detection (only the dynamic collision working along with continuous collisions solved it).
He uses a trigger collider in the Lose Collider GameObject, make sure to check the Is Trigger within the Lose Collider in order to work as expected;
A trigger collision event happens when a gameobject with a non kinematic collider rigidbody collides with a trigger collider
No problem
It is working as expected now? Let us know if you need something else and make sure to participate here in the community, it is a very nice group!
That is a good question, you should download Ben’s version of the project from the resources, and take a look and see what settings he left it at. I bet it will take all of 5 mins to check and see where his code is and which triggers are checked on the ball/paddle/and lose collider.