How to let a object dodge a collision?
Hey! I really tried hard but don't know how to set this up. In my game you're playing a servant who's holding a serving tray, this serving tray is a child of the first-person-controller. Now I want to make everything visually beautiful and this is where I'm stuck. The FP-Controller has a capsule collider and collides with other objects correctly, but its serving tray (child) still goes through the objects (it has a box collider but it still depends on the parents movement). So my solution or idea was:
- Adding rays to the serving tray, to detect if it's about to collide. 
- then setting the max distance of the serving tray to the other colliding object. So let's say the distance to the other object has to be > 1. 
- Then specifying a range where it's allowed to move itself in 
Then the result should be: As soon as the collision distance is < 1, it will move away from the collision to keep the distance of 1. If the distance is > 1, it will go back to its original position.
Just to illustrate: 
And here the game so far: https://www.youtube.com/watch?v=-mgii6HsjDo
Also an other problem is that the back and forth movement of the serving tray has to move smoothly, so probably for that a lerp function should be used, which makes it even harder.
Any other ideas how to solve this?
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                