- Home /
Game Objects acting like magnets?
Alright so I have two spheres in my scene. They both have rigidbodys with gravity, no constraints, and they're not kinematic. They problem is that they slowly come together like magnets and the objective is to avoid the other spheres. So how do I turn off this "magnet effect"? I have the following scripts attached to one of my spheres, but not the other.
var level : int;
function OnCollisionEnter(theCollision : Collision)
{
if(theCollision.gameObject.name == "Goal")
{
Application.LoadLevel(level);
}
} ---------------new script-----------------
var level : int;
function OnCollisionEnter(theCollision : Collision)
{
if(theCollision.gameObject.name == "Enemy")
{
Application.LoadLevel(level);
}
}
-----------new script---------------
var target : Transform;
function Update ()
{
transform.LookAt(target);
}
---------new script-----------
var level : int;
function OnCollisionEnter(theCollision : Collision)
{
if(theCollision.gameObject.name == "Bottom")
{
Application.LoadLevel(level);
}
}
Answer by funkyllama · Dec 11, 2011 at 03:32 PM
There's nothing that should cause them to automatically come together. Do u have a physics material on your objects? If not, try putting a physics material on your objects with a bit of static friction.. This will stop them just rolling on their own. You could also try tweaking the drag & angular drag properties of the rigidbody in the inspector