Scale Object and Keep its Position???
I am trying to scale my 3D objects, however when I scale them in code, they always move along an axis and changes its original position.
How can I simply resize (scale) my object while keeping it in its original location? I am trying to create a 3D map that is tiled with different tile sizes. The end result is my tiles are displaced when scaling. Also, it shouldn't be my code?.. The unscaled squares are exactly where they should be.
Quick demonstration of the problem:
I expected this to create a straight solid line along the x-axis, but at the scaling points it breaks up. I have been stuck on this for awhile. Here's an example of intended result:
surely someone knows how to solve this? :)
asked Apr 27 '17 at 09:34 PM in C++ Programming
This is happening because you are adding an instance of the mesh which isn't at the origin of the component, and then you're scaling the entire component. As a result, the offset between the instance and the component (SpawnLocation) is getting scaled as well.
Using InstancedStaticMeshComponents is kind of pointless here since you're only adding a single instance of the mesh to each component. Just use regular StaticMeshComponents and your problem will go away. Alternatively, transform SpawnLocation by the inverse of the block's intended scale to offset the change in position caused by scaling the component.
answered Apr 28 '17 at 12:19 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here