- Home /
Objects rotating after falling on another object with Physics & Gravity?
How can I have a realistic physic effect with gravity so that when the object falls on a slope, it will also rotate depending on the slope.
For example. here is what I want to happen:
But this is what's happening with my current setup:
Here is my component setup for the **blue box object** that is falling on the red slope.
And here is my component setup for the **red slope** that the blue box object is falling on.
Is there anything I need to do for this to happen?
If so, what is it? And how?
Google doesn't help, probably because I didn't know what to search for in the first place, I don't know what this certain problem is called.
Thanks!
EDIT:
And yeah, it slides down without rotating.
And it seems to only happen when I put the collider and the rigidbody on their parent. My object has a lot of 3d parts and it's all on 1 parent. When I put the collider and rigidbody on the parent, it does that. But when I put the collider and rigidbody on only one part (one of the child), it does what I wanted.
I could put a rigidbody and collider on every child, but when it falls, it makes all of them get seperated to each other. I want them to stick together and fall as I want them to fall.
How do I this?
Thanks :)
Wait -- so the blue thing isn't a box with a box collider, it's something more complicated?
Clearly, to me, the problem is in how the blue box is built. Look up compound colliders. The Q has gotten sidetracked enough that it might be better to repost, with a more descriptive title, and explain the set-up of the falling object.
Answer by Lylek · Jun 28, 2014 at 08:53 PM
When the box hits the slope does it just stick there, or does it slide down without rotating? You don't have a character controller on it, do you? And you shouldn't need a rigidbody on the slope.
Try creating a new scene. Add a plane, and angle it for a slope. Add a cube, and give it a rigidbody. You shouldn't need to adjust anything. Position the cube above the plane and press play, and it should tumble down the hill.
To repeat, the normal Unity set-up gives the effect you want. The blue box should bounce a bit, tip over, maybe start to flip over, but rock back, slide .... . It should look pretty good (depending how far it falls.) No matter what, it should always tip sideways.
$$anonymous$$aking it "do a road runner," like your 2nd picture set, takes more work.
Just recheck the set-up, or make a bare $$anonymous$$imum. $$anonymous$$aybe the red plane has the box collider flat, not tilted ... .
It slides down without rotating. And yeah, I don't have a character controller on it.
I'll try removing the rigidbody on the slope.
Thanks!
It seems to only happen when I put the collider and the rigidbody on their parent. $$anonymous$$y object has a lot of 3d parts and it's all on 1 parent. When I put the collider and rigidbody on the parent, it does that. But when I put the collider and rigidbody on only one part (one of the child), it does what I wanted.
I could put a rigidbody and collider on every child, but when it falls, it makes all of them get seperated to each other. I want them to stick together and fall as I want them to fall.
How do I this?
Thanks :)
Well, I'm not exactly sure "how you want them to fall", or what your set up is, and what all is falling where. Can you explain more?
Unity gets weird when rigidbodies are parented to each other. Avoid this at all costs. You can achieve the same affect of parenting by using joints.