Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Player Special Effects | Player Behavior
Fighting Game in Unity
course content

Зміст курсу

Fighting Game in Unity

Fighting Game in Unity

1. Unity Animation System
2. Player Behavior
3. Enemy Behavior
4. Improve the Game
5. Improve the Flappy Bird Game

bookPlayer Special Effects

RaycastHit2D.point

RaycastHit2D.point is a property in Unity used to retrieve the world space position where a 2D raycast hit an object's collider.

So, RaycastHit2D.point allows you to access the precise location where a 2D raycast makes contact with an object's collider, which is useful for performing actions or calculations based on the collision point.

In our case, we have used it to get the point of the attack of the enemy and play the particles at that point.

Placing Particles

After adding the particle as a child of our player, we will create a SerializeField for our particle and drag and drop it.

To play the particle, we need to set up its position, and we choose the raycast hit position for it.

So after changing its position to raycastHit.point, we will call Play() on the particles, so they start playing in the game and show us the visuals and the impact.

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 2. Розділ 4
We're sorry to hear that something went wrong. What happened?
some-alt