How to make an object follow the camera and stop following when that object collide with a wall or another object or when camera activates another object?


For my student project, I need to know how to do this purely using either javascript or blockly. I got the idea from my classmate but his code doesn’t either. Thanks for all helps appreciated!