About Store Forum Documentation Contact



Post Reply 
question Game::Item
Author Message
Babulesnik Offline
Member

Post: #1
question Game::Item
How do I know about the point in Game::Item

I need
Code:
cskel.getPoint("4").pos.y

Code:
Game::ObjMemx<Game::Item> ObjItem;

ObjItem[0]. not cskel
06-03-2011 01:03 PM
Find all posts by this user Quote this message in a reply
PRG3D Offline
Member

Post: #2
RE: question Game::Item
Code:
ObjItem[0].skeleton->findPoint("4")->pos.y;

EDIT: ObjItem[0].cskel.findPoint("4")->pos.y; My mistake smile
(This post was last modified: 06-03-2011 01:13 PM by PRG3D.)
06-03-2011 01:10 PM
Find all posts by this user Quote this message in a reply
Babulesnik Offline
Member

Post: #3
RE: question Game::Item
(06-03-2011 01:10 PM)PRG3D Wrote:  
Code:
ObjItem[0].skeleton->findPoint("4")->pos.y;

If so I am writing I get a critical program termination.Why?
06-03-2011 01:33 PM
Find all posts by this user Quote this message in a reply
PRG3D Offline
Member

Post: #4
RE: question Game::Item
Show your code.
06-03-2011 03:31 PM
Find all posts by this user Quote this message in a reply
Babulesnik Offline
Member

Post: #5
RE: question Game::Item
(06-03-2011 03:31 PM)PRG3D Wrote:  Show your code.

Close the program when I press KB_SPACE.Equally if you write in any other place.
Code:
Bool Update()
{
   if(Kb.bp(KB_ESC))return false;
   CamHandle(3.0f,22,CAMH_ZOOM|(Ms.b(1)?CAMH_MOVE:CAMH_ROT));

   Game::World.update(Cam.at);

   Gui.update();
  
   UpdateFrames(0.0035);

   if(Kb.bp(KB_SPACE))
   {
      
       Pos[0]=Vec(29.641,17,-2.182);Pos[1]=Vec(29.641,17,-1.574);Pos[2]=Vec(29.021,17,-2.156);Pos[3]=Vec(29.021,17,-1.552);Pos[4]=Vec(28.378,17,-1.870); //устанавливаем стартовые позиции кубиков для броска
       FREP(5)
       {
         ObjItem[i].matrix(Matrix(ObjItem[i].matrix().rotateXY(Random.f(45),Random.f(45)))); //рандомно крутим матрицу кубика
         ObjItem[i].pos(Pos[i]);ObjItem[i].actor.active(true);
        // ObjItem[i].actor.mass(10);
         ObjItem[i].actor.addImpulse(Vec(0,-2,0));
       }
    flt_var=ObjItem[0].skeleton->findPoint("4")->pos.y;

   }

   UpdateAnim(&ObjAnimatable[0],Anim1,Frame);
   UpdateAnim(&ObjAnimatable[1],Anim2,Frame);
   UpdateAnim(&ObjAnimatable[2],Anim3,Frame);
   return true;
}
(This post was last modified: 06-03-2011 04:00 PM by Babulesnik.)
06-03-2011 03:59 PM
Find all posts by this user Quote this message in a reply
PRG3D Offline
Member

Post: #6
RE: question Game::Item
Hmm.. I don't see any error. Maybe in extended item class, you should create cskel? See tutorial:
02 - Skeleton Points and 09 - Extending Game Object Class

in create method:
Code:
cskel.create(Skeletons("obj/Mechs/turrent/0.skel")).clear().updateMatrix(MatrixIdentity).updateVelocities();
06-03-2011 06:00 PM
Find all posts by this user Quote this message in a reply
Seba Offline
Member

Post: #7
RE: question Game::Item
Check if ObjItem[0] exist.
06-03-2011 08:15 PM
Find all posts by this user Quote this message in a reply
Babulesnik Offline
Member

Post: #8
RE: question Game::Item
(06-03-2011 08:15 PM)Seba Wrote:  Check if ObjItem[0] exist.
I'm not to understand. Please sample code.
06-03-2011 08:23 PM
Find all posts by this user Quote this message in a reply
Seba Offline
Member

Post: #9
RE: question Game::Item
Quote:if(Objitem.elms())
{
flt_var=ObjItem[0].skeleton->findPoint("4")->pos.y;
}
Second:
Quote:FREP(ObjItem)
{
ObjItem[i].matrix(Matrix(ObjItem[i].matrix().rotateXY(Random.f(45),Random.f(45)))); //рандомно крутим матрицу кубика
ObjItem[i].pos(Pos[i]);ObjItem[i].actor.active(true);
// ObjItem[i].actor.mass(10);
ObjItem[i].actor.addImpulse(Vec(0,-2,0));
}
06-03-2011 09:03 PM
Find all posts by this user Quote this message in a reply
Babulesnik Offline
Member

Post: #10
RE: question Game::Item
(06-03-2011 09:03 PM)Seba Wrote:  
Quote:if(Objitem.elms())
{
flt_var=ObjItem[0].skeleton->findPoint("4")->pos.y;
}
Second:
Quote:FREP(ObjItem)
{
ObjItem[i].matrix(Matrix(ObjItem[i].matrix().rotateXY(Random.f(45),Random.f(45)))); //рандомно крутим матрицу кубика
ObjItem[i].pos(Pos[i]);ObjItem[i].actor.active(true);
// ObjItem[i].actor.mass(10);
ObjItem[i].actor.addImpulse(Vec(0,-2,0));
}

Does not work (


Attached File(s) Image(s)
   
06-03-2011 09:56 PM
Find all posts by this user Quote this message in a reply
Seba Offline
Member

Post: #11
RE: question Game::Item
Quote:if(ObjAnimatable.elms())
{
UpdateAnim(&ObjAnimatable[0],Anim1,Frame);
UpdateAnim(&ObjAnimatable[1],Anim2,Frame);
UpdateAnim(&ObjAnimatable[2],Anim3,Frame);
}
or change:
Quote:FREP(ObjAnimatable)
UpdateAnim(&ObjAnimatable[i],Anim1,Frame);
06-03-2011 10:15 PM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #12
RE: question Game::Item
Skeleton and/or point may not exist either:

PHP Code:
Flt y 0;

if (
ObjItems.elms() && ObjItems[0].skeleton.is())
{
    if (
OrientP *point ObjItems[0].skeleton.findPoint("4"))
    {
        
point->pos.y;
    }


Lots of ways to break the code you posted, Babulesnik.
06-03-2011 10:45 PM
Find all posts by this user Quote this message in a reply
Babulesnik Offline
Member

Post: #13
RE: question Game::Item
(06-03-2011 10:45 PM)Driklyn Wrote:  Skeleton and/or point may not exist either:

PHP Code:
Flt y 0;

if (
ObjItems.elms() && ObjItems[0].skeleton.is())
{
    if (
OrientP *point ObjItems[0].skeleton.findPoint("4"))
    {
        
point->pos.y;
    }


Lots of ways to break the code you posted, Babulesnik.

2 errors "IntelliSense: expression must have class type" emphasized ObjItem[0]



Skeleton I loaded in WE...
Code:
Flt y = 0;

   if (ObjItem.elms() && ObjItem[0].skeleton->is())
   {
     if (OrientP *point = ObjItem[0].skeleton->findPoint("4"))
     {
        y = point->pos.y;
     }
   }

No errors, but the critical conclusion remains
(This post was last modified: 06-03-2011 11:30 PM by Babulesnik.)
06-03-2011 11:14 PM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #14
RE: question Game::Item
You must be attempting to access an index in either ObjItem or ObjAnimatable that does not exist, which causes the crash at run-time. Start commenting out code until it no longer crashes and then you'll know what's wrong. Anything that uses code like ObjItem[0] or ObjAnimatable[4] could be causing the crash.
06-04-2011 06:52 AM
Find all posts by this user Quote this message in a reply
Babulesnik Offline
Member

Post: #15
RE: question Game::Item
(06-04-2011 06:52 AM)Driklyn Wrote:  You must be attempting to access an index in either ObjItem or ObjAnimatable that does not exist, which causes the crash at run-time. Start commenting out code until it no longer crashes and then you'll know what's wrong. Anything that uses code like ObjItem[0] or ObjAnimatable[4] could be causing the crash.

Сrash is caused by the reference to a ObjItem[0]->skeleton.


ObjItem[0].skeleton; not crash;

ObjItem[0].skeleton->is(); crash !!!
(This post was last modified: 06-04-2011 10:59 AM by Babulesnik.)
06-04-2011 10:47 AM
Find all posts by this user Quote this message in a reply
Post Reply