c# cryengine 5.3 Maze generator

#1
HI, could someone make help or make tutorial for how to create a maze generator. i followed this tutorial https://www.cryengine.com/community_arc ... 4#p1305474, but it seem that in 5.3 entity Instantiate has changed and there is no documentation about it ( at least i couldn't find). so if someone could point me in right direction i would appreciate it. It doesn't necessarily need to be in c# if someone knows how to make it in flowgraph or schematycs that is also fine.

Thanks.

Re: c# cryengine 5.3 Maze generator

#3
Hi,

I tried the solution you posted but i cant get the objects to load. here is my code:

Code: Select all

    [EntityClass]
    public class MazeBlock : EntityComponent
    {
        private string _GeometryUrl = "Objects/Default/primitive_sphere.cgf";


        [EntityProperty(EntityPropertyType.Object, "Path where the geometry-file is located.")]
        public string GeometryUrl
        {
            get
            {
                return _GeometryUrl;
            }
            set
            {
                _GeometryUrl = value;
                //Initialize again so the geometry is reloaded.
                Initialize();
            }
        }

        private void Initialize()
        {
            Entity.LoadGeometry(0, _GeometryUrl);
        }
    }





----------------------------------------------------------------------------


void OnKey(SInputEvent e)
      {
         

            if (e.KeyPressed(EKeyId.eKI_F6))
            {

                MazeBlock mazblock = new MazeBlock();
               
      position = new Vector3(40, 40, 40);

                Entity.SpawnWithComponent<MazeBlock>(position, Quat.CreateIdentity(), 3f);
               
               

            }

        }

Re: c# cryengine 5.3 Maze generator

#4
You don't need to instantiate EntityComponents with new. The following OnKey method should work:

Code: Select all

void OnKey(SInputEvent e)
{
   if (e.KeyPressed(EKeyId.eKI_F6))
   {
      var position = new Vector3(40, 40, 40);
      MazeBlock mazblock = Entity.SpawnWithComponent<MazeBlock>(position, Quat.CreateIdentity(), 3f);
   }
}

Re: c# cryengine 5.3 Maze generator

#5
Thanks for fast reply. it didnt quite work the first time i tried, but i found the problem why it wasnt loading. i needed to change my EntityClass to this adding the constructor:

Code: Select all

   [EntityClass]
    public class MazeBlock : EntityComponent
    {
        private string _GeometryUrl = "Objects/Default/primitive_sphere.cgf";


        [EntityProperty(EntityPropertyType.Object, "Path where the player's geometry-file is located.")]
        public string GeometryUrl
        {
            get
            {
                return _GeometryUrl;
               
            }
            set
            {
                _GeometryUrl = value;
                //Initialize again so the geometry is reloaded.
               
            }
        }
        public MazeBlock()
        {
            var entity = Entity;

            // Load the third person model
            entity.LoadGeometry(0, _GeometryUrl);
        }
       
    }
}

Who is online

Users browsing this forum: No registered users and 1 guest