Page 1 of 1

Spawing Item Slightly Higher?

Posted: Sun Apr 05, 2020 5:46 am
by Jason Campbell
Hello all,

I've finally got a loot box that spawns a random item inside it.Problem is it places it at the very bottom of the chest, so it can't be seen.

Any way to spawn it in the center of the transform of the box?

Thanks

%trans is the chests transform
%lootItem = new Item()
{
  datablock = %item;
  static = true;
  rotate = false;
};
%trans=%obj.getTransform();
%lootItem.setTransform(%trans);

Re: Spawing Item Slightly Higher?

Posted: Sun Apr 05, 2020 9:03 pm
by Jason Campbell
I figure it out. I re-imported the box with the center at where I wanted the item to spawn. Works great now.

Re: Spawing Item Slightly Higher?

Posted: Mon Apr 06, 2020 11:46 am
by Duion
I hardly know any games that actually spawn items inside boxes, in most games you click the box and a GUI opens that shows that there is an item in the box, while there is actually nothing inside it for real. Other games spawn the items outside of the box when you "open" it or it is destroyed.

Re: Spawing Item Slightly Higher?

Posted: Mon Apr 06, 2020 6:58 pm
by Jason Campbell
I got it working pretty slick now. I have a random item(weapon, health kit, ammo, ect) spawn right before the open lid animation.

I wanted it to occur without a GUI. I have a button press to pickup stuff so this works well.

Re: Spawing Item Slightly Higher?

Posted: Mon Apr 06, 2020 9:31 pm
by fLUnKnhaXYU
you can use vectorAdd in the case that you might want to add a large item and make it appear above the prize box .

Re: Spawing Item Slightly Higher?

Posted: Tue Apr 07, 2020 12:28 am
by Jason Campbell
Nice! Thanks f. That is what I was looking for originally.

Re: Spawing Item Slightly Higher?

Posted: Tue Apr 07, 2020 8:02 am
by Duion
If it appears on top of the box anyways, you can shoot a raycast from the top and it will always spawn exactly on top of the surface, start 1.5m from the top or so in case it is indoors so it will not spawn on the upper floor.