About Store Forum Documentation Contact
Donations:
309$/mo



Post Reply 
Flying items
Author Message
Ogniok Offline
Member

Post: #1
Flying items
Hi.

I have a problem with my game. I have some items on ground:

[Image: Screenshot%200..bmp]

Then, I'm picking them up to my inventory:

[Image: Screenshot%201..bmp]

But after I drop the item onto the world the items are flying:

[Image: Screenshot%202..bmp]

[Image: Screenshot%203..bmp]

This is my inventory update code:

Code:
void InventoryGui::update(Game::Chr &owner)
{
   if(inv)
   {
      if(Ms.bp(0)) // if mouse button pressed
      {
         if(inv->slot[SLOT_TEMP].valid()) // if we have an item attached with mouse
         {
            if(Gui.ms()==&list) // if mouse cursor is on the list
            {
               inv->slot[SLOT_TEMP].clear(); // clear the slot reference which will result in "putting back the item into the list"
               setGui();                     // update visuals
            }else
            if(Gui.ms()==Gui.desktop() || !Gui.ms()) // if mouse cursor is on the desktop or nothing (this means the game world area)
            {
               owner.itemDropDown(inv->slot[SLOT_TEMP]()); // drop the item onto the world
            }
         }
         else // we don't have an item so we want to get one
         {
            if(Gui.ms()==&list) // from the list
            {
               if(Item *item=list())
               {
                  inv->slot[SLOT_TEMP]=item;
                  setGui();
               }
            }
         }

         REP(SLOT_NUM)
            if(Gui.ms()==&slot_img[i][0] || Gui.ms()==&slot_img[i][1]) // if we want to put the item onto the i-th slot
               if(inv->slotsCanBeSwapped(SLOT_TEMP,i))
               {
                  Swap(inv->slot[SLOT_TEMP],inv->slot[i]); // swap temporary with i-th slot
                  setGui();                                // update visuals
               }
      }
   }
}

How can I fix it?
(This post was last modified: 04-22-2011 03:18 PM by Ogniok.)
04-22-2011 12:55 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Flying items
probably Actor::kinematic,gravity
but you must be doing something wrong I think, as in inventory tutorial the items dont fly when dropped down
04-22-2011 01:41 PM
Find all posts by this user Quote this message in a reply
Ogniok Offline
Member

Post: #3
RE: Flying items
I've noticed that these objects has no gravity. If is place them in World Editor some meters over the terrain they are not falling when i start the game.
04-22-2011 02:01 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: Flying items
what object type and access mode in WE?
04-22-2011 02:43 PM
Find all posts by this user Quote this message in a reply
Ogniok Offline
Member

Post: #5
RE: Flying items
Type: OBJ_ITEM
Access: Default

EDIT: When I'm playing my world in World Editor items are "flying" too.
Problem solved. I had to generate physics again.
It is falling only when phys is created in World Editor. When I'm creating it in Mesh Editor and then link with mesh in World Editor it is not working.
It seems to be working now.
(This post was last modified: 04-22-2011 03:24 PM by Ogniok.)
04-22-2011 02:45 PM
Find all posts by this user Quote this message in a reply
Post Reply