|
Hi! I'll give you an example of my problem: I have 2 cubes with rigidbodys. I use AddForce in cube n1 to control it. When I attach cube n2, the extra weight will affect the direction/velocity. This is my objective. By attaching both of them with a joint I achieved that objective. The problem is that they are not securelly connected, i.e., they "wobble" as if they are connected by a spring. The effect I wanted is that of a magnet, but with the added effect of the weight dragging of cube n2. How can it be done?
(comments are locked)
|
|
You can parent the 2nd object to the first and then alter the weight and centre of mass with scripts. http://unity3d.com/support/documentation/ScriptReference/Rigidbody-centerOfMass.html After moving the centre of mass you need adjust the position where you apply force because by default, AddForce applies force at the centre of mass. http://unity3d.com/support/documentation/ScriptReference/Rigidbody.AddForceAtPosition.html Thanks for the reply. I tried parenting cube n2 to cube n1 and changing the center of mass of n1's rigidbody, but that didn't do nothing. By parenting, when I add force to n1's rigidbody, both cubes move as one and there is no dragging of n2.
May 28 '10 at 03:08 PM
Damienthorn
You need to use Add Force at the original position (default is at the centre of mass)
May 28 '10 at 05:25 PM
spinaljack
(comments are locked)
|
