- Home /
Draging Rigid body....for real-time loaded models
Hello Unityrs,
I have an OBJ file which represents my 3D model I load at run time in Unity. Now, I attached it a RigidBody, MeshCollider, and DragRigidbody.js script from Unity package. I dunno why I place my model in 0,0,0, but with the rigidbody, it keeps falling in the scene without interacting with the plane, and in the scene there is also a built-in cube. I can pick and drag the cube but I can't pick and drag my model... This is my code:
var obj; obj = new OBJ();
Camera.main.transform.position = Vector3(0,10,0);
Camera.main.transform.rotation = Quaternion.Euler(90,0, 0);
StartCoroutine(obj.Load(filename));
gObj = obj.obj;
gObj.transform.position = Vector3(0,2,0); //Positioning the object in (0,0,0);
gObj.transform.localScale = Vector3(0.008,0.008,0.008);
gObj.AddComponent(Rigidbody);
gObj.AddComponent(MeshCollider);
gObj.AddComponent(NetworkView);
gObj.GetComponent(Rigidbody).useGravity = false;
gObj.GetComponent(Rigidbody).isKinematic = false;
gObj.AddComponent(DragObject);