About Store Forum Documentation Contact
Donations:
309$/mo



Post Reply 
Problem on Game.Destructible
Author Message
Amnedge1331 Offline
Member

Post: #1
Problem on Game.Destructible
Hello Esenthel !

My problem is when i try to extend a custom object with Game.Destructible the object doesn't appear in game and when i use the toStatic() function of Game.Destructible or extend my custom object with Game.Static it working, so Game.Destructible is not totaly implemented or I miss something ?
(This post was last modified: 05-02-2016 12:17 PM by Amnedge1331.)
05-02-2016 10:16 AM
Find all posts by this user Quote this message in a reply
RedcrowProd Online
Bronze Supporter

Post: #2
RE: Problem on Game.Destructible
haven't tried it, but are you calling the draw call / update properly ?

i think georgatos made it work couple month ago, so it should be working
(This post was last modified: 05-02-2016 04:31 PM by RedcrowProd.)
05-02-2016 03:59 PM
Find all posts by this user Quote this message in a reply
Tottel Offline
Member

Post: #3
RE: Problem on Game.Destructible
Maybe because it needs to know what to draw? I haven't used it myself yet, but have a look at the ToStatic() method.
05-02-2016 06:33 PM
Find all posts by this user Quote this message in a reply
Amnedge1331 Offline
Member

Post: #4
RE: Problem on Game.Destructible
I'll explain more about how i do:

first I init a list of "Ressource" in a ObjMap container, then I use setObjType of World to associate my ObjMap with my OBJ_TYPE : "OBJ_RESSOURCE".

I clear this ObjMap at the first call of Game Update (to clear all the object on the map with OBJ_TYPE : "OBJ_RESSOURCE"), then the server send me the OBJ_RESSOURCE to create with an UID unique (to know which object are in interaction with the Player for the server), position and UID Object with the method:
objCreateNear or objCreate.
I already did this method for Item and Construction by player it works (these objects don't extend Game.Destructible), but I identify a problem about my "Ressource" apart from Game.Destructible because when i try to acess Mesh and Phys after the call of objCreateNear or objCreate I got an error so the first problem is here. Howether when I don't clear my ObjMap associate with OBJ_RESSOURCE there is Phys and Mesh in the void virtual create of my Ressource and the object apear on screen (when I extend Game.static to my Ressource with Game.Destructible I always got nothing)

Hope it helps to understand.. smile
05-03-2016 04:33 PM
Find all posts by this user Quote this message in a reply
RedcrowProd Online
Bronze Supporter

Post: #5
RE: Problem on Game.Destructible
then if i understand right, ressource is already not working with game.static and you cant access its data right ? after the objcreatenear you loose your phys and mesh ?
(This post was last modified: 05-04-2016 03:20 PM by RedcrowProd.)
05-04-2016 03:19 PM
Find all posts by this user Quote this message in a reply
Amnedge1331 Offline
Member

Post: #6
RE: Problem on Game.Destructible
That's it, but now I got something with Game.Destructible I got a Mesh end a Phys but his Matrix is always set to 0.. I try everything with these method:

Code:
virtual Vec    pos         (                ); // get position
virtual void   pos         (C Vec    &pos   ); // set position
virtual Matrix matrix      (                ); // get matrix  , returned matrix is normalized
virtual Matrix matrixScaled(                ); // get matrix  , returned matrix is scaled by 'scale'
virtual void   matrix      (C Matrix &matrix); // set matrix  , 'matrix' must be normalized

I try to normalize the matrix etc

Here is my code which create my Ressource:
Code:
Matrix matrixTmpObjPos=Matrix(ressources.objs[i].posi.scale, ressources.objs[i].posi.pos);
matrixTmpObjPos.orn().rotateZ(ressources.objs[i].posi.angle.z).rotateX(ressources.objs[i].posi.angle.x).rotateY(ressources.objs[i].posi.angle.y);
Object ob = *ObjectPtr(ressources.objs[i].obj);
Game.Obj* obTmp=Game.World.objCreateNear(ob, matrixTmpObjPos.normalize(), &ressources.objs[i].id);
if(obTmp!=null)
{
   ressourceTerrain.find(ressources.objs[i].id).matRef=matrixTmpObjPos.normalize(); //Try to pass the matrix into object to force set in the Update()
}

Here is my Ressource:
Code:
class RessourceMap : Game::Destructible
{
  
      // saved
   UID           id;
   UID           idU;
   UID           objId;
   Object        obj;
   Matrix        matRef;
  
   virtual void create(Object &obj)
   {
      super.create(obj);
      id=obj.type();
      objId = super.id();
      idU=obj.base().id();
      T.obj=obj;
      if(mesh)LogN("Mesh ok!");
      //super.reliesOn();
      //toStatic   ();  // try
   }
  
   virtual Bool update()
   {
      super.update(); // I try without this too
      /*matrix().setPos(matRef.pos);  // try
      matrix(matRef); */              // try
      LogN(S+matrixScaled().asText());
      LogN(S+matrix().asText());
      return true;
   }
  
   virtual UInt drawPrepare()
   {
      uint modes=0;
      modes=super.drawPrepare();
      mesh->draw(matrixScaled()); // I try with matrix() too
      return modes;
   }
  
}

Any tips ?
(This post was last modified: 05-04-2016 11:54 PM by Amnedge1331.)
05-04-2016 11:53 PM
Find all posts by this user Quote this message in a reply
Jben Offline
Member

Post: #7
RE: Problem on Game.Destructible
Game.Destructible is disabled since version EE2, @Esenthel ?
05-06-2016 06:59 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #8
RE: Problem on Game.Destructible
Hello,

Please wait for next release, I'll make a tutorial.
05-07-2016 12:24 AM
Find all posts by this user Quote this message in a reply
Jben Offline
Member

Post: #9
RE: Problem on Game.Destructible
Realy cool smile Thanks Esenthel
05-07-2016 12:28 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Amnedge1331 Offline
Member

Post: #10
RE: Problem on Game.Destructible
Very nice Esenthel, thank you smile
05-07-2016 01:19 PM
Find all posts by this user Quote this message in a reply
Amnedge1331 Offline
Member

Post: #11
RE: Problem on Game.Destructible
Hello @Esenthel,

I see that you create a tutorial on Game.Destructible but we don't have access to source liscence, so can you give us this exemple ?
05-20-2016 11:41 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #12
RE: Problem on Game.Destructible
Hi,

This will be available in the next Binary release, because I've made some changes to the engine too to make it work.
05-20-2016 01:03 PM
Find all posts by this user Quote this message in a reply
Amnedge1331 Offline
Member

Post: #13
RE: Problem on Game.Destructible
Ok so that was normal that I can't use it because it was not working
05-20-2016 02:06 PM
Find all posts by this user Quote this message in a reply
Post Reply