Spawing Item Slightly Higher?

There are no stupid questions, just stupid answers.
7 posts Page 1 of 1
Jason Campbell
Posts: 362
Joined: Fri Feb 13, 2015 2:51 am
 
by Jason Campbell » Sun Apr 05, 2020 5:46 am
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);
Jason Campbell
Posts: 362
Joined: Fri Feb 13, 2015 2:51 am
 
by Jason Campbell » Sun Apr 05, 2020 9:03 pm
I figure it out. I re-imported the box with the center at where I wanted the item to spawn. Works great now.
Duion
Posts: 1626
Joined: Sun Feb 08, 2015 1:51 am
 
by Duion » Mon Apr 06, 2020 11:46 am
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.
Jason Campbell
Posts: 362
Joined: Fri Feb 13, 2015 2:51 am
 
by Jason Campbell » Mon Apr 06, 2020 6:58 pm
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.
fLUnKnhaXYU
Posts: 172
Joined: Wed Nov 15, 2017 8:19 am
by fLUnKnhaXYU » Mon Apr 06, 2020 9:31 pm
you can use vectorAdd in the case that you might want to add a large item and make it appear above the prize box .
Jason Campbell
Posts: 362
Joined: Fri Feb 13, 2015 2:51 am
 
by Jason Campbell » Tue Apr 07, 2020 12:28 am
Nice! Thanks f. That is what I was looking for originally.
Duion
Posts: 1626
Joined: Sun Feb 08, 2015 1:51 am
 
by Duion » Tue Apr 07, 2020 8:02 am
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.
7 posts Page 1 of 1

Who is online

Users browsing this forum: No registered users and 3 guests