Hello fellow developers! I made a trash bin, which you can push. You can touch it with certain tools to dispose of them. Each tool has its own mass and the trash can fills up proportional to how much you put in it. For the reference videos below each Trash Bag has a mass of 10 and the maximum of the trash bin is 20.
What do you want to achieve?
I want the “garbage” part to stay inside the trash bin after moving it.
Thank, you, very much for taking the time to help me with this problem. Is it possible for you to explain a little bit in detail what was actually happening?
im not entirely sure how everything is set up so i cant help you completely
generally your code is just trying to recalculate the base c0 of the motor from the global cframe of the trash can and then multiply the y axis offset from that (im not entirely sure why you have a z axis offset) so i think its much easier to save the c0 in a constant and multiply it from there
In my opinion that is weird how saving the CFrame in a constant makes it work, but taking it everytime for calculation leads to this behaviour. The Z axis offset is because the bottom is not entirely alligned to the middle. Thank, you, for taking the time to also explain this.
my guess is theres some logic error in your code when recalculating the base c0
the reason saving the c0 as a constant works is:
lets say you have the c0, which is just the cframe offset the motor has from the part0 object. this offset is always constant but also relative to the part0’s cframe. since we just wanna change the height distance from the part0, we can just add the original height to the new height we want (if we added onto the current height, itd be taller than we wanted to achieve) since the c0 is relative this means the x, z, and orientation are all preserved which is the behavior you’re seeking