Move item related to distance to another object

In this example the goal is: move Boy towards Deer and when the distance between the two object is less than “3” the boy must stop and move to another animation or action.
The topics are: get the movement of Boy more flowing (fluid) and evaluate if there are some other solutions more efficient in order to move object and stop in front or near other object.
Thanks a lot.

You can create a “3” long tube then attach it to the belly of the boy; finally, when the tube collided with the deer the boy stop walking (event “collided with” ).

I hope it help. Good luck

Hi @Roberto_Raspa,

Are your questions, “How can I get the movement of Boy more flowing (fluid)?” and “Is there a more efficient solution?”?

It would be good to see your code, in order to evaluate it - you can share it in 2 ways:

  1. Make the CoSpace remixable

  2. Share an image of the code

Geoff @ TechLeap

Sorry for the mistake. Now you can find the remix version.

Dear [tajajtsidi], thanks. I know this way. The challenge is to understand how work also with the distance. Thanks very much for your effort.

Ok, check this cospace

I hope this is what you’re looking for. :slightly_smiling_face:


Great work, @tajajtsidi! We can even get simpler than this by ditching the variable:

Hope this helps! Let me know if you have any further questions about this.


Thanks very much, now is perfect!

Nice, thanks to all!

Great to hear! Please mark the solution for this topic - this will help other creators.

Geoff @ TechLeap

1 Like