- Home /
Reg. 'hit me toys' effect
Hi I want to apply 'hit me toys' like effect to my Domino object but after hit it doesn't raise again like 'hit me' do.For that i have use hing joints but it's not work very well because it require so many calculations.Any suggestion pls.
Rajiv
Answer by aldonaletto · May 29, 2012 at 12:56 PM
Let physics do the job for you: set the rigidbody.centerOfMass below the rigidbody - this will produce a self-righting effect:
function Start(){ // sets the center of mass 2 units below the object's center: rigidbody.centerOfMass = Vector3(0, -2, 0); }You will need a hinge joint only if you don't want the object to slip when hit.
Thanks Aldo.Actually i'm working on do$$anonymous$$o rally kind game so the problem is that i want to design do$$anonymous$$o object in such a way that it attach to the ground and fall in the speed of real do$$anonymous$$o as well force can be come any direction e.g from backside-forward side of do$$anonymous$$o. So i've use hing joints and on collision do$$anonymous$$o fall it self. but it require so many calculation for settings join pls suggest any alternatives.
So, you don't want the self-righting behaviour, only the do$$anonymous$$o toppling effect. Real world do$$anonymous$$oes don't have any joint: they just fall over the next do$$anonymous$$o, and rigidbodies would behave the same. Could this work for you?
But if you really need a hinge joint, just set its anchor at the lower center - at least with Unity cubes scaled to look like do$$anonymous$$oes (scale 0.5, 1, 0.15) it works very well: set the hinge joint anchor to (0, -0.5, 0) and the axis to Vector3.right.