Hello again everyone i have happened across a new problem i am having trouble solving.
So i am trying to set up a display thing with the tables and shelves with furniture system in my game. Currently what happens is that the parent actor of the furniture looks for any sockets on the mesh then creates and attaches collision boxes to those sockets. as seen below.
The boxes are currently set to not hidden so i can see their position in game to confirm they are correct.
now the problem i am having is with sizing of the static mesh when it is added. I was able to add the static mesh, and make it appear in the right location but I cant get the sizing right.
The axe is okay but that little cube should be much bigger. I have tried various different way to get the sizing correct but once the size is correct for the cube the axe is huge
Is there anyway to make this work? when i try to simulate physics to get the mass correctly it just doesn’t exist, it shows up in the editor panel and when i click on it it tells me its in the right spot, but it cant be seen, so i am thinking it is just incredibly small. Or i have the same problem where things are too large or too small. If anyone can give me some help or an idea i would appreciate it.
Hey @AndracoDragons! Can you show the components window of the actor?
What I’m thinking is… it might simply be fixed by reordering the children of the spawned actor. Because when you adjust the size of a component (Such as static mesh or collision volume, in this case) You also adjust the size of all of its children!
So the collision boxes are added to the mesh if the mesh has sockets, all the furniture pieces use the same furniture parent BP and just change their function based off an Enum.
We’re definitely getting close, I can smell it. What’s the code for the spawning of the display item?
Because what I’m seeing is: The box collision is spawning with 1,1,1 x the size of the table (FurnitureItem). You could theoretically increase that size in the “Set Box Extent” without increasing the size of anything else. Not scale, if you increase relative transform scale it will increase the size of all it’s children or anything it spawns, and I’m wondering if the spawned DisplayItem is being attached to the box, and that’s why it’s growing so large. Can you show the code that spawns the DisplayItem?
The code responsible for spawning the display item is actually those first three images in the OP. the widget spawns the actor, then sets the static mesh of the display item actor, it then sets the actor location to the same as the collision box, then it attaches the display item actor to the collision box component, then there is a little bit a delay to make sure all the information is there before setting the world scale of the static mesh. Using get component bounds i use the box extent divided by the mass of the static mesh, then that vector is divided by the sphere radius if the collision box before finally plugging into world scale.
Are you sure you don’t want to set this to Keep World? You want the actor to scale to the scale of the box? If they’re both just 111 it shouldn’t matter. Keeping it world will allow you to scale the actor before attaching it if necessary.
You should be able to set the size of the box with the “Bounds” adjustment, don’t mess with scale. The DisplayItem actor is indeed the child of the collision box, so adjusting the size of the box is going to directly affect the size of the actor.
Going back to the original question… I don’t know that there is a true way to just get the size of a bounds box and set it to be a certain width around the actor with any sort of reliability if the actors themselves are a large variety of shapes. It would likely be better to just use one size box for each displayed item as an interaction box, and have the actor itself use it’s own collision that the static mesh can have built in. That seems to be the easiest way to go… I’m sure there’s a more complex answer that will require a lot more work, but honestly I’m stuck on this one.
Yea I have switched it back to keep reletive scale I got to the point where I was just changing settings to see what happened lol, and I have more or less set the settings so it to works with most of the item meshes, my current thought is to put this on the back burner until I either get a brain wave, find a tutorial, or decide to go the long route and add a secondary mesh to each displayable item that is sized to fit in the display areas. But for now I am going to leave it as it is and move onto the next task on my list which is a fishing system. I appreciate the help though but I am also stumped on this.