Contenido del Curso
Fighting Game in Unity
Fighting Game in Unity
Player 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.
¡Gracias por tus comentarios!