TUTO Unity 3d – Comment créer des effets d'impacts de balles



TUTO Unity 3d – Comment créer des effets d’impacts de balles

Script :

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Impacts : MonoBehaviour
{

public Camera FpsCamera;
public float range = 100.0f; // portée
public GameObject ImpactsParticles; //l’effet

// Use this for initialization
void Start()
{

}

// Update is called once per frame
void Update()
{
if (Input.GetButtonDown(« Fire1 »)) // Si on appuie sur clic gauche alors on lance la fonction FIRE()
{
RaycastHit hit;

if (Physics.Raycast(FpsCamera.transform.position, FpsCamera.transform.forward, out hit, range))
{
if (ImpactsParticles && hit.transform.tag == « stone ») //tag stone signifie que la impact apparaitra que sur le object ayant le tag stone
{
GameObject ImpactsParticlesEffect = Instantiate(ImpactsParticles, hit.point, Quaternion.FromToRotation(Vector3.forward, hit.normal));
ImpactsParticlesEffect.transform.SetParent(hit.transform); // l’impact devient enfant de l’objet sur lequel le raycast à taper.
}
}

}
}
}

———————————————————————————————————–

unity 3d,
unity in diversity,
unity 5,
unity in diversity dance,
unity 2d,
unity tutorial,
unity 5 tuto fr,
unity tuto fr,
unity queen latifah,
unity 3d tuto,
unity thefatrat,
unity 3d tuto fr,
unity assassin’s creed,
unity animation,
unity adam,
unity android,
unity assassin’s creed gameplay fr,
unity axero,
unity animation personnage,
unity android tuto fr,
unity architecture,
unity ai,
a* unity tutorial,
a* pathfinding unity,
a creed unity,
âssassins creed unity,
unity by thefatrat,
unity bande annonce vf,
unity best game,
unity blacksmith,
unity best graphics,
unity base,
unity building system,
unity bande annonce,
unity basics,
unity build android,
unity c#,
unity crack,
unity character controller,
unity cardboard,
unity car,
unity chan,
unity craft,
unity camera,
unity card game,
unity chicha,
a c unity trailer,
unity c sharp tutorial,
c sharp unity,
assassin’s creed unity c,
unity c tutorial,
game dev c unity3d,
unity çalışmıyor,
assassin’s creed unity tam çözüm,
unity player çalışmıyor,
unity demo,
unity diversity,
unity diversity dance,
unity documentary,
unity de thefatrat,
unity dropouts,
unity dance,
unity drag and drop,
unity dialogue system,

Source

KA2Studio
Logo
Compare items
  • Total (0)
Compare
0