Skip to content

MeshCollider components on the map tiles? #56

@binakot

Description

@binakot

I use raycasting to place some objects on the 3d map with a correct height. But atm there is no MeshCollider component on the map tiles. That's why raycasting does not work.

no-mesh-collider

If I add MeshCollider in Unity editor when project is playing - everything works. Unity assign the correct mesh in runtime from editor.

add-mesh-colldider-in-unity-editor

But when I try to add MeshCollider from code, MeshCollider component misses the mesh reference.

add-mesh-colldider-in-code

This code doesn't help.

[RequireComponent(typeof(MeshRenderer), typeof(MeshFilter), typeof(MeshCollider))]
public class UnityTile : MonoBehaviour, INotifyPropertyChanged
{
    <...>
    void Start()
    {
        GetComponent<MeshCollider>().sharedMesh = MeshFilter.mesh;
    }
}

In earlier SDK versions raycasting worked out of the box. Now I'm using v0.5.1-beta. How can I do it now?
Thanks.
Cheers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions