- Home /
How to make a sphere fall from a cube when more than 50% of the sphere is outside the cube
I have a sphere that is moving on a cube. But when i reach the cube edges, it doesn't matter that more than 90% of the sphere is outside the cube, the sphere is not falling. How can i make my sphere to fall when >50% it outside the cube?
Imagine that the cube is the roof of a building. So, in IMAGE 2 because of the gravity the ball should fall. In IMAGE 1, after changing the cube's size to X: 0.7, Y: 1, Z: 0.7 the ball is doing what i want it to do, but the visual effect is not very nice, the ball it's falling through the cube's texture.
So, how do i solve this problem?
I just did a quick test and it seems to work as expected (new scene, add cube, add sphere, put Rigidbody in sphere, tilt cube a tiny bit to generate roll). Perhaps you could give more info. What you describe sounds like there is a different shape collider in the sphere mesh.
Answer by AngryOldMan · Mar 11, 2011 at 05:16 PM
No its not clear because you havn't said what is wrong or right in each picture nor have you explicitly expressed what you want to achieve. I've had to piece together exactly what you want over these lengthy posts which has proved impossible. Did you try what i suggested in the previous post? are you adjusting the collider size and not the actual size of the cube? all i can gather is that you want a ball to roll off a cube. I don't understand what the problem is?
I suggest start again, create a cube, adjust the scale of the cube in it's transform NOT the collider size in the collider component!!! Then create a sphere and add a rigidbody. I have just done it myself now and the physics are fine.
I suggest when asking a question make sure you clearly explain what you want to achieve, how you have tried to achieve it (what exactly you have done), and what precisely it's going wrong (and possibly why if you can figure that out)
Sorry for the delay, i've been out of town for a while. I've tried again as you said, new cube, new sphere etc etc, but the result is the same. Can you please upload somewhere what you've done because i simply cannot accomplish that. Thanks.
Open new scene. Go to GameObject ~> Create Other ~> Cube. Resize the cube's scale under the transform component to x,10 y,1 z,10. Rotate on any axis by 5 degrees. Then go to GameObject ~> Create Other ~> Sphere. With the sphere selected go to Component ~> Physics ~> Rigidbody. $$anonymous$$ake sure the sphere is completely outside and above of the cube (put it in the center) Then press play. The ball will drop onto the cube, roll in whatever direction you have tilted the cube then fall off when it reaches the edge. I think you should look at some basic tutorials if you're having trouble with this task.
Of course that works, but after you add a CharacterController and attach a script what you've said it no longer applies. I thought that is obviously that my sphere is controlled by me when i said this: "I havve a sphere that is moving on a cube"
How does "I have a sphere that's moving on a cube" mean "I have a sphere that I control as a player"? This is what I mean by being specific. I've no time to give you a lesson in english just to understand your questions especially when you're one of these people who doesn't mark off answers. The problem you're having is with the size a specification of your character controller's collider http://unity3d.com/support/documentation/Components/class-CharacterController.html if you had made sense in your 1st post you could have had this fixed by now!
I thought i was clear, my bad. This will do, i should have read that before, thanks.
Answer by AngryOldMan · Mar 05, 2011 at 02:34 PM
reduce the size of the collision box on the cube so that the sphere appears to be inside the cube but is still actually rolling across the collider and therefor isn't actually inside.
Well, this works, but the sphere will be falling through the cube, not after it reaches it's edge.
If i set, let's say the size to 0.5 ins$$anonymous$$d of 1 on the cube collider, then i will have a quarter on my cube sides without collision box. Well, when the sphere reaches gets either on the left or on the right side, it fall through the visible mesh of the cube, but i want to fall down from the cube like is rolling when it's reaching on one of the sides. Hope now i was a bit more clear with i'm trying to do.
erm no not really, your grammar is a bit broken. I think you want to extend your collider so it covers the x and z size but then have it shorter on the top?so if your cube's size is 1,1,1 then your colliders size should be 1,0.9,1.
I have updated the post and added a picture. Hope that all is more clearer now.
Your answer
![](https://koobas.hobune.stream/wayback/20220613111448im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Need to Find the Radius of an Object? 2 Answers
Rigidbodies not reacting to one another 2 Answers
Make a capsule collider BETWEEN 2 objects 0 Answers
Enemy AI Hearing System 3 Answers