Spawning an object and setting the scale

Hi,

Currently I have an item pickup system that when you pick up an object it displays a details widget and also spawns the actor from a class referenced in a data table. I pick up bandages and the size is fine however whenever I pickup any weapons the actor is too big.

My question is how would I set the scale so that each object that spawns in front of the player takes up the same amount of screen space?

hi @DusksEmbrace961

So im guessing the pickup is too big as you are scaling the bandage? so you scale the gun too?

Maybe the bandage should be scaled up in the original actor/mesh so that all spawns are default 1,1,1 scale

All the objects are placed in the world and are all the same scale and it wouldn’t work if I change the mesh scale on the BP as the gun would be too small in the world. Ideally any item I pick would fit inside an invisible box in the viewport so that’s what I’m trying to achieve. As far as I can tell a lot of games with the same feature work like this and allow the user to rotate the model.

Hi DusksEmbrace961,

You can get the Bounding box of the meshes, and calculate the scale to fit the mesh with from the largest extent:

well all items are different sizes yet scaled 1,1,1 (usually)

so for you to have any item that fits in the “invisible Box” you will need to get its bounds (as @RecourseDesign stated) then rescale the BP for this viewport.

If you are able to pick this item up, then spawn a new one at the default scale and attach that to the player, leaving the viewport object unchanged (or destroyed if thats the idea, your choice)

Thankyou, I’ll try this method out