Lob effect for Mortar bullet?

Hello.

This is driving me mad. I have tried to use iTween’s “Acurelob Example” but it wont work properly in my scene. It just shoots straight forward towards the target and just makes a little “bump” at det very end of the itween. If I comment out the “MoveTo” it bounces fine straight up and down, but then not towards the target ofc.

Any insights?

This is the current script on the bulletprefab to lob:

iTween.MoveBy(gameObject, iTween.Hash(“y”, lobHeight, “time”, lobTime / 2, “easeType”, iTween.EaseType.easeOutQuad));
iTween.MoveBy(gameObject, iTween.Hash(“y”, -lobHeight, “time”, lobTime / 2, “delay”, lobTime / 2, “easeType”, iTween.EaseType.easeInCubic));
iTween.MoveTo(gameObject, iTween.Hash(“position”, target.transform.position, “time”, lobTime, “easeType”, iTween.EaseType.linear));

What can I use instead of iTween to make this lobbing effect? Gravity will cause the ball to fall down which will be wrong in my scene as its set up 90 degrees in semi-2d

You can use rigidbodies and AddForce to create a lob effect. You just attach a rigidbody to the motor and then when you want to shoot it use AddForce to give it some acceleration. Then the gravity from the rigidbody will bring it down.

1 Like