My code is:
plane = GameObject.CreatePrimitive(PrimitiveType.Plane);
plane.transform.parent = transform;
plane.transform.localPosition = Vector3(0,-0.5,-0.5);
plane.transform.localScale = Vector3(0.1,0.1,0.02);
plane.AddComponent(MeshCollider);
plane.GetComponent(MeshCollider).convex = true;
plane.renderer.enabled = false;
plane.AddComponent(Rigidbody);
plane.rigidbody.mass = 1;
plane.rigidbody.useGravity = true;
plane.rigidbody.freezeRotation = true;
plane.AddComponent(HingeJoint);
plane.hingeJoint.connectedBody = rigidbody;
hinge = plane.hingeJoint;
it ran well on my project. but when I tried it on another project, Unity shows these errors:
Actor::updateMassFromShapes: Compute mesh inertia tensor failed for one of the actor’s mesh shapes! Please change mesh geometry or supply a tensor manually!
UnityEngine.Transform:set_parent(Transform)
UnityEngine.Transform:set_parent(Transform)
PullPillar:InitializePlane() (at Assets\Quan\PullPillar.js:21)
PullPillar:Start() (at Assets\Quan\PullPillar.js:14)
[\unity\stuff\external-source\physx\novodex\SDKs\Physics\src\NpActor.cpp line 150]
ConvexMesh::loadConvexHull: convex hull init failed!
UnityEngine.MeshCollider:set_convex(Boolean)
UnityEngine.MeshCollider:set_convex(Boolean)
UnityEngine.MeshCollider:MeshCollider$set_convex$System.Boolean(Object, Object[ ])
System.MulticastDelegate:invoke_object_object_object[ ](Object, Object[ ])
Boo.Lang.Runtime.RuntimeServices:smile:ispatch(Object, String, Type[ ], Object[ ], DispatcherFactory)
Boo.Lang.Runtime.RuntimeServices:smile:ispatch(Object, String, Object[ ], DispatcherFactory)
Boo.Lang.Runtime.RuntimeServices:SetProperty(Object, String, Object)
PullPillar:InitializePlane() (at Assets\Quan\PullPillar.js:25)
PullPillar:Start() (at Assets\Quan\PullPillar.js:14)
[\unity\stuff\external-source\physx\novodex\SDKs\Cooking\Src\ConvexMeshBuilder.cpp line 522]
what’s wrong with my code? How can I fix this?