Рет қаралды 10,236
DISCLAIMER:
Replace the line:
transform.up = Vector3.MoveTowards(transform.up, mousePosition, _rotationSpeed * Time.deltaTime);
with:
var dir = mousePosition - transform.position;
transform.up = Vector3.MoveTowards(transform.up, dir, _rotationSpeed * Time.deltaTime);
Learn how you can rotate your turret towards your mouse cursor (or anything you desire), fire projectiles, and kill enemies.
Art Assets: imgur.com/a/W47V2UD
Script: bit.ly/3l3LyGr
=========
❤️ Become a Tarobro on Patreon: / tarodev
=========
🔔 SUBSCRIBE: bit.ly/3eqG1Z6
🗨️ DISCORD: / discord
✅ MORE TUTORIALS: / tarodev
MORE TUTORIALS:
/ tarodev
0:00 Intro
0:08 Setup the Turret
0:29 Following the mouse pointer
1:49 Rotation smoothing
3:12 Making the projectile
5:38 Shooting the projectile