- Home /
Question by
ematahankaraman · Aug 11, 2021 at 06:38 AM ·
animationaddforcedesign
Should I Use Animation or Force for Following the Path Type of Game?
I have a game design problem. Please check the image attached first. I have player frogs on the bottom side of the scene. These frogs have to follow the marked path following every key down. The map won't change, it is fixed. But I can't be sure that should I use constant animations for every changing place movement or add force for the frog's rigid body?
untitled.png
(18.2 kB)
Comment
Best Answer
Answer by Mehmedcan · Aug 11, 2021 at 08:31 AM
public Transform[] pathTransforms;
private int placeCounter;
private void Jump()
{
if (Input.GetKeyDown(KeyCode.J))
{
placeCounter++;
transform.DOJump(pathTransforms[placeCounter].position, // jump position
5f, // jump power
1, // #of jumps
1f, // duration (second)
false);
}
}
@ematahankaraman You can use DoTween package for your project and DOJump() function to animate frogs jumping.
I will try it but it will be my first time with DoTween.
Your answer
![](https://koobas.hobune.stream/wayback/20220613041518im_/https://answers.unity.com/themes/thub/images/avi.jpg)