Unity Tutorial - Screen / Object shake.

preview_player
Показать описание
Unity tutorial covering a basic script to add a some GUI FX, namely screen (camera) shake, or shake an object (e.g. player, enemy, etc).

----------------------------------------------------------------------------------------------
- The artist is a good friend of mine, please show him some support if you like any of the tunes in this video.

Check our my assets on the Unity Asset Store:

Or my projects on Unity Connect:
Рекомендации по теме
Комментарии
Автор

Love the script and it helped me. Can I suggest something:

if you move 'Vector3 OriginalPos = transform.position' to a global variable.

Set OriginalPos in the start function (OriginalPos = transform.position;)

Then change Vector3 NewPosition = Random.insideUnitSphere * (Time.deltaTime * ShakeAmount);
to
Vector3 NewPosition = OriginalPos + Random.insideUnitSphere * (Time.deltaTime * ShakeAmount);

This way the script will not bounce the object back to (0, 0, 0) if it moves (eg player or enemy)

keyobardian
Автор

This only works if the object being shaken is at the origin. Otherwise, the object will move a great distance instead of shaking. Try setting the unwanted axis to zero and doing a += on the position instead.

Skiggles
Автор

Hi, and thank you again for sharing the script. When is shaking is true the object is centered in the middle of the screen and then starts shaking. Any recommendation to make the object shake in its current position? THANKS!

rubpty
Автор

Wow man, Thank you SO much!! I used it for my score count. Respect.

lukascook
Автор

Love this effect, although how to do you change the script to shake a moving camera that tracks the player? the camera seems to snap to another area of the screen and back

DieselFuel
Автор

Great tutorial very intresting, thank you :)

christophersimplusplus
visit shbcf.ru