Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Transform Gizmos into real 3d meshes
#2
Okay, I figured it out with a little script which allows me to create geometries and colliders on the childs when I create a new CP :
(But if there is an other way, it would be nice to know about it Smile )

function addMeshtoControlPoint (indexCP:int)
    {
        // On définit la taille du control point
        transform.GetChild(indexCP).gameObject.transform.localScale = new Vector3(10,10,10);
        // On ajoute le MeshFilter au child crée
        transform.GetChild(indexCP).gameObject.AddComponent(MeshFilter);
        // On injecte dans ce nouveau MeshFilter, le meshFilter de notre Sphere de reference
        transform.GetChild(indexCP).gameObject.GetComponent(MeshFilter).mesh = sphereMeshToUse.GetComponent(MeshFilter).sharedMesh;
        
        // On ajoute le meshCollider au child crée
        transform.GetChild(indexCP).gameObject.AddComponent(MeshCollider);
        
        // On ajoute le meshRenderer au child crée
        transform.GetChild(indexCP).gameObject.AddComponent(MeshRenderer);
}

 
Reply


Messages In This Thread

Possibly Related Threads…
Thread Author Replies Views Last Post
  Maintaining vertical orientation of extruded meshes rickgplus 3 2,127 01-24-2025, 09:24 PM
Last Post: _Aka_
  Tunnel Colliders and Looping Meshes Petusarian 5 2,674 07-17-2024, 02:36 PM
Last Post: _Aka_
  Invisible Gizmos In Latest Curvy Splines orrenravid1 1 1,310 06-11-2024, 07:36 AM
Last Post: _Aka_
  Disable rebuild of meshes in dynamic mode Zilk1 3 1,907 05-27-2024, 08:14 AM
Last Post: _Aka_

Forum Jump: