About Store Forum Documentation Contact



Post Reply 
Create a shape with the ineisis object
Author Message
Jben Offline
Member

Post: #1
Create a shape with the ineisis object
Hello,
Actually we work on the PathWorld creation and we need to put PathObstacle on map but the problem is object's actor don't have a shape, that's our StaticEditor object code (from ObjStatic on the MapEditor):
Code:
/******************************************************************************/
class StaticEditor : Obj
{
   flt                angleX=0;
   flt                angleY=0;
   flt                angleZ=0;
   ObjectPtr          obj;
   Actor              actor;
   Matrix             matrix;
   Box                boundingBox;
   MeshBase           base;
   Shape              shape;
   Box                box;
   int                iterateur=0;
   Game.Static        staticR;
   Memx<PathObstacle> pO;
  
  ~StaticEditor() {deleteActor();} // delete actor before physical body
  
   void setMatrix()
   {
      matrix.pos=posEditor;
      matrix.orn().setRotateXY(super.angleX, super.angleY).scale(super.scale);
      //pO.create(actor.shape(false));
   }
  
   Vec scaleS()
   {
      return super.scale;
   }
  
   Vec2 angleXY()
   {
      return Vec2(super.angleX, super.angleY);
   }
  
   // manage
   virtual void create(flt angleX, flt angleY, flt angleZ, C ObjectPtr &obj_params)
   {
      T.angleX=angleX;
      T.angleY=angleY;
      T.angleZ=angleZ;
      T.obj  =obj_params;
      T.staticR.create(*obj);
   }

   // operations
   virtual void deleteActor() {actor.del();}
   virtual void createActor() { if(obj && obj->phys()){
   actor.create(*obj->phys(), 1, matrix.avgScale(), true).matrix(Matrix(matrix).normalize());
   staticR.actor.matrix(Matrix(matrix).normalize());staticR.update();
   }}

   // draw
   virtual uint draw()
   {
      if(obj)if(C MeshPtr &mesh=obj->mesh())if(Frustum(mesh->box, matrix)){mesh->draw(matrix);}
      return 0;
   }
   virtual void drawShadow()
   {
      if(obj)if(C MeshPtr &mesh=obj->mesh())if(Frustum(mesh->box, matrix)){mesh->drawShadow(matrix);}
   }

   // io
   virtual void save(File &f)
   {
      super.save(f);
      f.cmpUIntV(0);
      f.cmpAngle1(angleY);
      f.putStr(obj.name());
   }
   virtual bool load(File &f)
   {
      if(super.load(f))switch(f.decUIntV())
      {
         case 0:
         {
            f.decAngle1(angleY);
            obj=f.getStr();
            setMatrix();
            
         }return true;
      }
      return false;
   }

   virtual void compress(File &f)
   {
      super.compress(f);
      f.cmpAngle1(angleY);
      f<<obj.id();
      
   }
   virtual bool decompress(File &f)
   {
      if(super.decompress(f))
      {
         f.decAngle1(angleY);
         obj=f.getUID();
         setMatrix();
         return true;
      }
      return false;
   }
}
/******************************************************************************/
Memx<StaticEditor> StaticsEditor;
/******************************************************************************/

Here is our create of an Actor:
actor.create(*obj->phys(), 1, matrix.avgScale(), true).matrix(Matrix(matrix).normalize());

but actor.shape() don't work with the creation of a PathObstacle. So can you help us on how can we do this, thank you guys. smile
07-26-2015 11:32 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply