Wikipédia de RayMind

Formations & Tutos

De RayMind wiki
Aller à : navigation, rechercher

Contenus et liens de formations et Tutos :

Grap & Drop d'objets

Lien vers le tutoriel

Tutoriel expliquant comment développer un script permettant d'attraper un objet avec la souris et le lâcher pour qu'il tombe sur le sol.
Vidéo d'explication du grap & drop d'objets (https://www.youtube.com/watch?v=jOOdJZS987Y)

Script principal GrabAndDrop.cs du tutoriel

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

public class GrabAndDrop : MonoBehaviour {
  GameObject grabbedObject;
  float grabbedObjectSize;

  void Start() {
  }

  GameObject GetMouseHoverObject (float range)
  {
    Vector3 position = gameObject.transform.position;
    RaycastHit raycastHit;
    Vector3 target = position + Camera.main.transform.forward * range;
    if (Physics.Linecast(position, target, out raycastHit))
      return raycastHit.collider.gameObject;
    return null;
  }

  void TryGrabObject (GameObject grabObject)
  {
    if (grabObject == Null || !CanGrab(grabObject))
      return;

    grabbedObject = grabObject;
    grabbedObjectSize = grabObject.renderer.bounds.size.magnitude;
  }

  bool CanGrab(GameObject candidate)
  {
    return candidate.GetComponent<RigidBody>() != null;
  }

  void DropObject ()
  {
    if (grabbedObject == null)
      return;

    if (grabbedObject.GetComponent<RigidBody>() != null)
      grabbedObject.GetComponent<RigidBody>().velocity = Vector3.zero;

    grabbedObject = null;
  }

  void Update ()
  {
    Debug.Log (GetMouseHoverObject(5));

    if (Input.GetMouseButtonDown(1)) {
      if (grabbedObject == null)
        TryGrabObject(GetMouseHoverObject(5));
      else
        DropObject();
    }

    if (grabbedObject != null) {
      Vector3 newPosition = gameObject.transform.position + Camera.main.transform.forward * grabbedObjectSize;
      grabbedObject.transform.position = newPosition;
    }
  }
}

Animation

Liens vers les tutoriaux

Tutoriel d'animation (https://unity3d.com/fr/learn/tutorials/topics/animation)
Tutoriel de porte qui s'ouvre et se ferme en fonction qu'on s'en approche ou non (https://www.youtube.com/watch?v=uhlRoV_msPc)
Autre tutoriel d'ouverture de porte mais cette fois elle est animée (https://www.youtube.com/watch?v=E9rLA-gt5Ss)
Hover Car avec sons (https://unity3d.com/fr/learn/tutorials/modules/beginner/live-training-archive/hover-car-physics?playlist=17120)
Arme animée avec Animator (https://www.youtube.com/watch?v=aJOH0Jlo4YA)
Animation d'un personnage (https://www.youtube.com/watch?v=wdOk5QXYC6Y)
La suite avec déplacement en vue 3ème personne (https://www.youtube.com/watch?v=7NktwerZFro)
Sabre laser (https://www.youtube.com/watch?v=ZT8eutqzW5A)
Déplacement relatif dans une animation - Root motion (https://unity3d.com/fr/learn/tutorials/topics/animation/authoring-root-motion)
Tutoriel animation Mecanim avancé (à voir avec ce forum ici)

Mesh

Lien vers le tutoriel

Edition de Mesh directement dans Unity

Pathfinding

Liens vers les tutoriaux

A* Pathfinding (E01: algorithm explanation)
A* Pathfinding (E02: node grid)
A* Pathfinding (E03: algorithm implementation)
A* Pathfinding (E04: heap optimization)
A* Pathfinding (E05: units)
A* Pathfinding (E06: weights)
A* Pathfinding (E07: smooth weights)

Tower Defense

Lien vers le tutoriel

https://noobtuts.com/unity/tower-defense-game