I think that wouldn’t work if there was a change in terrain - I would need to apply different amounts of force depending on the angle of the terrain and I need the crate to maintain its distance to the player - but also to be able to fall of a cliff.
If I think about this scenario for a while:
I am walking towards the crate and applying force - i suddenly stop but it keeps on going so I need to stop it’s movement entirely to maintain distance - It might work on a terrain that’s just flat.
If I’m pushing it off a cliff, and if it is standing on the edge and leaning it’s just about to fall so i stop pushing it forward so the crate movement stops - it’s probably not going to fall(I had a scenario similar to this one when I severed the constraints on a physics constraint actor, and the box wouldn’t fall until it got a small impulse to awaken it. I still didn’t know about “sleeping” physics back then). I might do a raycast to detect if the crate is leaning off a cliff and and then just ignore it’s movement but that could backfire.
If i get this to work i still have the trouble of calculating the force needed to push the crate based on terrain angle - if I’m going uphill or downhill, especially on the transitional parts like the beginning of a ramp - all the while maintaining distance to player
And I don’t know how to do this.
I am, however, going to try applying force (or even setting velocity) and I’ll see if I can come up with something for these special cases to achieve the desired results.
So, thank you for the idea.
But I don’t think I am going to be able to write my way out of this so other ideas are still welcome.