Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  How to select the obi rope by mouse click?
#4
(21-05-2018, 03:18 AM)cowill Wrote: Hi josemendez, thanks for you reply, I'm new in Unity. My problem is how to add a suitable collider to the rope mesh? Physcis.Raycast  needs a collider.  I added a mesh collider to the Rope Mesh, but the collider is  fixed when the rope is animating. My solution so far is updating the mesh collider in Update() function. Like this:
Code:
void Update () {
GetComponent<MeshCollider>().sharedMesh = null;
GetComponent<MeshCollider> ().sharedMesh = GetComponent<MeshFilter> ().sharedMesh;
}
Are there any better solutions?  Thanks again. Sonrisa

You could only update the mesh when the user clicks, no need to do it every Update().
Reply


Messages In This Thread
RE: How to select the obi rope by mouse click? - by josemendez - 21-05-2018, 08:41 AM