# Recoil Patterns

**URL:** <https://forum.playcanvas.com/t/recoil-patterns/16614>\
**Category:** Help & Support\
**Created:** [January 1, 2021, 5:09pm UTC](https://forum.playcanvas.com/t/recoil-patterns/16614 "2021-01-01T17:09:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![projectvexxed](https://forum.playcanvas.com/letter_avatar_proxy/v4/letter/p/3ab097/32.png) [@projectvexxed](https://forum.playcanvas.com/u/projectvexxed)\
**Post date:** [January 1, 2021, 5:09pm UTC](https://forum.playcanvas.com/t/recoil-patterns/16614/1 "2021-01-01T17:09:36Z")

</div>

Can someone tell me how to code Recoil Patterns? I don’t know how to do it so any help is greatly appreciated.

---

<div class="post-metadata">

**Author:** ![Leonidas](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/leonidas/32/6495_2.png) [@Leonidas](https://forum.playcanvas.com/u/Leonidas)\
**Post date:** [January 1, 2021, 5:50pm UTC](https://forum.playcanvas.com/t/recoil-patterns/16614/2 "2021-01-01T17:50:18Z")

</div>

Hi @projectvexxed,

For simple offset from cursor recoils on a straight line you can use the pc.Vec3.lerp method. Basically when the weapon fires you offset the current cursor/model position by a value and use lerp to move it up/down. Using time based inertia as the lerp alpha value.

> **[Vec3 | Engine API Reference - v2.7.7](https://api.playcanvas.com/engine/classes/Vec3.html#lerp)**
>
> Documentation for Engine API Reference

For more complex recoil patterns that use special curves you can use the pc.Curve object. A good example is the following doing camera animation.

[https://developer.playcanvas.com/en/tutorials/camera-following-a-path/](https://developer.playcanvas.com/en/tutorials/camera-following-a-path/)
