- Home /
Passing through an object
Alright so in my game there is a ball, a paddle, and bricks. I am making a brick breaking game and have the problem of after the ball bouncing around alot especially from higher heights it phases right throught my platform instead of bouncing off. at first i thought it was my speed so i put some speed limitations on it but even going slow it does it. can someone please help me?
Answer by Ingen · Aug 13, 2012 at 11:34 AM
Hi, I hope this can help you
http://wiki.unity3d.com/index.php?title=DontGoThroughThings#C.23_-_DontGoThroughThings.js
This is definitly useful and helpful to know but it only applys when objects are going to fast and that is not the case here
maybe U can use add Force, ins$$anonymous$$d physics bounce, the problem is how calculate the angle of collision, and based on it the angle to the of the ball must go
I hope is understandable
If you are doing an arkanoid game, I would not recommend AddForce which is going to add force (as the name implies) and then slows down. Flipper game would do just fine but Arkanoid needs a constant speed. You'd rather use
rigidbody.$$anonymous$$ovePosition(rigidbody.position + velocity);
and the velocity being calculated at the collision:
velocity.x = velocity.x - 2 * norm.x * Vector3.Dot(velocity, norm.normalized);
velocity.z = velocity.z - 2 * norm.z * Vector3.Dot(velocity, norm.normalized);
that is if you have your level on the z and x axis which is likely. velocity.y being always 0.
I was using addForce already ins$$anonymous$$d of physics bounce and have been looking for a way to get constant speed so thank you. and also with how i have it now it automaticaly works the angles correctly .
Answer by speedything · Aug 13, 2012 at 11:36 AM
This is going to be one of those annoying issues where things that usually work occasionally don't!
You're going to have to do some bug testing to narrow down the problem. You've started to think about this by looking at the speed, but other things you should check are.
Add a Debug.Log to the collision so that you can see if the collision is triggering or not.
If you launch a new ball after the first has phased-through, does this one work ok or not? If its ok then the problem is probably with the ball. If it isn't it's probably the paddle.
If you remove all the bricks and just bounce it, does it go wrong then? If so then the bricks aren't involved with the problem.
Check these things out and see if you can narrow down the issue. As it stands its too open a problem with too many things that it could be.
Your answer

Follow this Question
Related Questions
2D runner, need a help 0 Answers
Move an object from A to B to C etc.? 2 Answers
Show object for a specific platform only. 3 Answers
Platform dependent flags required in Using/Namespace definition? 1 Answer