Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: TerraImagina on February 06, 2020, 06:03:17 AM
-
Hello,
I want to be able to drag an object to a constraint area only.
I have been following this awesome tutorial about touch control with playmaker,
There is an example that allow to drag an object with touch.
I have been trying to modificate it to constrain or clamp the movement to certain area, but without success...
This exemple use a translate action to move the object, with variable touchXdelta and touchYdelta that come from GetTouchInfo action.
I tried using a float clamp on those variable to constrain them, before the translate action, but the result is not working as intended.
Does it work to use float clamp for a translate action ? Is there another way to constrain a drag object?
Thank you!
-
Hi,
this gives a good demonstration of how it can be done:
https://answers.unity.com/questions/633457/limiting-game-object-position-by-rect.html
have you checked the "Move towards with constraint" sample on the ecosystem?
Bye,
Jean
-
Hi JeanFabre
The "Move towards with constraint" sample was exactly what I was looking. Now I understand the logic of how the constrain is working.
Thank you!
-
Hi,
great!
Bye,
Jean