Forum Discussion
Stopping an Object's Motion Path
I have a cube set to move in a rightward motion path when a button is clicked and leftward when a different button is clicked. The object is relative to the start point so it just continues going in one direction or the other depending on which button is clicked, and keeps going off the slide unless the opposite direction button is clicked. What is an easy workaround to set boundaries for this type of thing so the object stops moving once it hits the edge of the slide?
I tried using a true/false variable and a transparent object so that when the moving object intersected the transparent object, it would change the variable and stop moving on the path, but that didn't work. Any creative ideas that would work?
- WaltHamiltonSuper Hero
You can't stop an animation once it starts, so you have to keep it from moving if the move will take it too far. Set a condition to move the object unless the variable is True. Be sure the transparent object is larger than the distance moved.
- JudyNolletSuper Hero
Here's a post that explains how to track the movements to prevent an object from going off the slide. It also includes a demo file.