Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
dTub
Скачать

🔥 How to Make a Game Like Lost War ads - Part 28 || Fix Movement Trigger Bug & Bullet Spawner

Автор: Tasty Cherry Games

Загружено: 2025-12-02

Просмотров: 19

Описание:

In this Unity game development tutorial, we fix a player movement trigger bug and then build a complete bullet shooting system from scratch. This video is part of our ongoing Unity series where we focus on writing clean, optimized, and scalable code for real games.

We begin by addressing a critical issue in the player movement logic. The problem occurred when the player entered +10 or -10 trigger zones, where movement was restricted to only one direction. After reviewing the code closely, we discovered that a condition checking clientStatus == 1 was completely unnecessary. This logic was mistakenly copied from an older script and caused the directional restriction bug. Once removed, the player can move freely in both directions without breaking the movement system.

After confirming that the fix works correctly and does not affect the player controller, we move on to implementing a bullet shooting system.

To keep the project clean and modular, we create two separate scripts:

Bullet Movement Script

Bullet Spawner Script

The Bullet Movement Script is responsible for moving the bullet forward from the gun’s tip. We use Unity’s Update() method to continuously move the bullet in the forward (Z) direction, ensuring it follows the player’s aiming direction. Bullet speed is controlled using a SerializeField variable, allowing us to tweak values directly from the Inspector without modifying code.

Instead of using heavy bullet models, we create a simple cube-based bullet. Since bullets travel at very high speeds, complex meshes are unnecessary and waste performance. To improve visibility, we add a basic material with emission, giving the bullet a laser-like appearance. This approach keeps performance high while still looking visually clean.

We also handle pivot and axis alignment issues, which are common when working with weapon models. By using empty GameObjects and aligning them correctly with the world axis, we ensure bullets spawn in the correct direction every time.

Once the bullet is ready, we convert it into a prefab, making it reusable throughout the project. We also assign a Bullet tag, which will later help with collision detection and damage logic.

Next, we create the Bullet Spawner Script. This script listens for player input (such as pressing the F key) and spawns the bullet prefab at the gun’s tip. This keeps firing logic separate from bullet behavior, making the system easier to expand later with features like fire rate control, ammo systems, or object pooling.

By the end of this video, you’ll have:

A fixed movement trigger system

A working bullet prefab

A clean bullet movement script

A functional bullet spawner

Proper prefab and transform setup

This tutorial is perfect for beginners and intermediate Unity developers working on:

FPS or TPS games

Shooting mechanics

Player movement bugs

Prefabs and transforms

Performance-friendly project setups

In future videos, we’ll expand this system with collision detection, damage handling, and object pooling for better performance.
🧠 Why This Approach?

Instead of using heavy bullet models, we use a simple cube with emission, which is:

Performance-friendly

Nearly invisible at high speed anyway

Ideal for fast-paced shooters

We also structure everything into separate scripts (movement & spawner) to keep the project scalable and clean.

This tutorial is perfect if you are:

Learning Unity FPS mechanics

Building a shooting system step by step

Fixing trigger-based movement bugs

Working with prefabs, transforms, and forward direction

Optimizing for performance in real-time games

📌 In the next video, we’ll continue by improving the bullet spawner, handling collisions, and expanding the shooting logic.

🔥 How to Make a Game Like Lost War ads - Part 28 ||  Fix Movement Trigger Bug & Bullet Spawner

Поделиться в:

Доступные форматы для скачивания:

Скачать видео mp4

  • Информация по загрузке:

Скачать аудио mp3

Похожие видео

🔥 How to Make a Game Like Lost War  - Part 29 || Modular bullet firing system - BulletSpawner

🔥 How to Make a Game Like Lost War - Part 29 || Modular bullet firing system - BulletSpawner

Интернет в небе: Сергей

Интернет в небе: Сергей "Флеш" о том, как «Шахеды» и «Герберы» научились работать в одной связке

AI Trends 2026: Quantum, Agentic AI & Smarter Automation

AI Trends 2026: Quantum, Agentic AI & Smarter Automation

Чат ПГТ 5.2 - это похоронная. Самый УЖАСНЫЙ релиз в истории ИИ

Чат ПГТ 5.2 - это похоронная. Самый УЖАСНЫЙ релиз в истории ИИ

UE5.7 (5.6) Gizmo, Navigation and Viewport camera improvement

UE5.7 (5.6) Gizmo, Navigation and Viewport camera improvement

Same 128GB but cheaper

Same 128GB but cheaper

10 AIs Play Mafia: Vigilante Edition

10 AIs Play Mafia: Vigilante Edition

Is Zorin OS the Best Windows Replacement?

Is Zorin OS the Best Windows Replacement?

VRC paint, canvas, camera and render texture Tutorial

VRC paint, canvas, camera and render texture Tutorial

Decrypting SSL Traffic from a Chinese Security Camera - Hacking the Anran IP Camera

Decrypting SSL Traffic from a Chinese Security Camera - Hacking the Anran IP Camera

Najpotężniejsza BROŃ UKRYTA na DNIE BAŁTYKU

Najpotężniejsza BROŃ UKRYTA na DNIE BAŁTYKU

Google Just Killed All Competitors + Disney Gave Mickey Mouse to AI (10 Updates)

Google Just Killed All Competitors + Disney Gave Mickey Mouse to AI (10 Updates)

100 SZOKUJĄCYCH faktów o ŻYDACH w USA

100 SZOKUJĄCYCH faktów o ŻYDACH w USA

🔥 How to Make a Game Like Lost War  - Part 31 ||  bullet collision with enemies

🔥 How to Make a Game Like Lost War - Part 31 || bullet collision with enemies

1 design in 15 different software

1 design in 15 different software

Rymanowski, s. Skass: Radość i wątpliwości

Rymanowski, s. Skass: Radość i wątpliwości

Reinforcement Learning Tutorial - RLVR with NVIDIA & Unsloth

Reinforcement Learning Tutorial - RLVR with NVIDIA & Unsloth

🔥 How to Make a Game Like Lost War ads Part 27 || | Fix Hand on Gun Using Two Bone IK (Step by Step)

🔥 How to Make a Game Like Lost War ads Part 27 || | Fix Hand on Gun Using Two Bone IK (Step by Step)

🔥 How to Make a Game Like Lost War - Part 30 || bullet script, bullet system scripting

🔥 How to Make a Game Like Lost War - Part 30 || bullet script, bullet system scripting

"Nie mogę się pozbierać". Komorowski nie wytrzymał po słowach Millera

© 2025 dtub. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: [email protected]