Point and Shoot / Turret Tutorial - Unity

  Рет қаралды 10,209

Tarodev

Tarodev

Күн бұрын

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

Пікірлер: 11
@durvids474
@durvids474 3 жыл бұрын
Great tutorial, thank you! Looking forward to more!
@fess1024
@fess1024 3 жыл бұрын
Thank you friend!
@mitchellcaldwell6745
@mitchellcaldwell6745 Жыл бұрын
How would you set this turret up for a 3D project? I'm having trouble getting it to work?
@warget
@warget 2 жыл бұрын
Q: Why don't you spawn the bullet with a rotation? I am thinking that the rotation can take into consideration the direction - this way, you don't need Init() on bullet, but just update, and apply force forward
@walney2008
@walney2008 2 жыл бұрын
very good tutorial, how spawn enemys any locals ?
@SharathThe1
@SharathThe1 2 жыл бұрын
Hey, thanks for these videos! Could you help with two question about this? 1. why does this work only if your camera is set to Orthographic mode? 2. why did you ask us to replace a line with ```var dir = mousePosition - transform.position; transform.up = Vector3.MoveTowards(transform.up, dir, _rotationSpeed * Time.deltaTime);``` in the description? it actually does a 360 rotation when your mouse is at the bottom
@abisInc9277
@abisInc9277 Жыл бұрын
Try using, dir.z = 0; instead of mousePosition.z = 0;
@noobcraft5712
@noobcraft5712 3 жыл бұрын
Gooooooood
@dreadge
@dreadge 2 жыл бұрын
how would i make the bullet point the same way the cannon is aiming the moment it was fired? ( i have a longer bullet )
@lawrencemiller2642
@lawrencemiller2642 Жыл бұрын
help i have the same problem :D
@wesleyfortin6251
@wesleyfortin6251 7 ай бұрын
set the bullets front transform to the same value of the turret (from mouse pos)
2D follow AI with Unity - [Tutorial]
6:34
Tarodev
Рет қаралды 7 М.
Unity Tilemaps - Hex, rectangle, isometric + rule tiles
18:38
ХОТЯ БЫ КИНОДА 2 - официальный фильм
1:35:34
ХОТЯ БЫ В КИНО
Рет қаралды 2,4 МЛН
Joven bailarín noquea a ladrón de un golpe #nmas #shorts
00:17
2D Top Down Shooting POINT & CLICK Unity Tutorial
13:55
Unity - Point and Shoot Tutorial
9:28
Press Start
Рет қаралды 81 М.
How to make a drag and drop game in Unity
19:29
Tarodev
Рет қаралды 48 М.
Pixel Perfect Lights and Particles in Unity! (Tutorial)
8:52
How to get Mouse Position in 3D and 2D! (Unity Tutorial)
10:20
Code Monkey
Рет қаралды 134 М.
How to make AI Turret Bots in UNITY - 2D
14:59
The Game Guy
Рет қаралды 26 М.
Unity - Drag & Shoot Tutorial
23:52
Loafwad
Рет қаралды 11 М.
Turrets - Build a 2D Tower Defence Game in Unity #4
17:27
Muddy Wolf
Рет қаралды 14 М.
2D Animation in Unity (Tutorial)
21:53
Brackeys
Рет қаралды 2,4 МЛН