I am basically trying to scale a box mesh based on a different mesh that will change during runtime. The reason is because when I will apply phisycs to it I dont want to use the collisions of the changing mesh but scale the box around it so it makes sense and then use that box for collisions.
For an example: if the mesh was a banana I would want the box to be more flat and small whereas if it was lets say a lamppost I would want the box to scale narrow and tall.
here is an example of how to fit a collision box component to a static mesh component. In this example, I placed the logic in the contructor script, but in your case you just need to place this logic in the function that is called everytime you change the mesh.
Hi! Thanks for your answer but this is not exactly how I have it set up, (which I should have clarified earlier).
The changing mesh Is a childactor component, which is parented to the box.
Another thing is that I am adding a little push whenever one of these blueprints spawn, so I cant have any simple collision on the staticmesh that is in the childactor. (Otherwise it will also have weight and it will glitch out and fly away)
Atention: the calculation for SetLocation are done considering the pivot of the meshes are at their base and at their center, like in the default chair, couch, door, …
So if the pivot is at the center of the mesh, then no calculations are required, and you can connect the box bounds origin directly to new location.