What do you want to save?
Add Code snippet
New code examples
-
C# 2021-11-18 17:14:19
unity3d gameobject follow path
public class EnemyBehavior : MonoBehaviour{ public Path pathToFollow; //PATH INFO public int currentWayPointID = 0; //speeds public float speed = 2; public float reachDistance = 0.4f; public float rotationSpeed = 5f; float distance; //DISTANCE TO NEXT ... Add solution -
C# 2021-11-15 01:21:13
rotation facing mouse unity
//Rotate Object to face Mouse (2D, Rotate on Z-Axis) Vector3 pos = Camera.main.WorldToScreenPoint(transform.position); Vector3 dir = Input.mousePosition - pos; float angle = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg; transform.rotation = Quaternion.Angle... Add solution -
C# 2021-11-14 18:25:10
look rotation only on y axis in unity
var dir = PlayerMovement.playerTransform.position - transform.position; Quaternion LookAtRotation = Quaternion.LookRotation(dir); Quaternion LookAtRotationOnly_Y = Quaternion.Euler(transform.rotation.eulerAngles.x, LookAtRotation.... Add solution -
C# 2021-11-14 07:27:20
how to make a ball roll left and right in unity
void FixedUpdate () { //SPHERE MOVEMENT float hor = Input.GetAxis("Horizontal"); float ver = Input.GetAxis("Vertical"); &nb... Add solution -
C# 2021-11-11 17:14:16
unity 2d rotate towards direction
Vector3 targ = staticCompassTarget.transform.position; targ.z = 0f; Vector3 objectPos = transform.position; targ.x = targ.x - objectPos.x; targ.y = targ.y - objectPos.y; float angle = Mathf.Atan2(targ.y, targ.x) * Mathf.Rad2Deg; trans... Add solution -
C# 2021-11-08 14:48:26
compass direction mobile unity
using System.Collections; using System.Collections.Generic; using UnityEngine; using TMPro; using System; public class CompassBehaviour : MonoBehaviour { public TextMeshPro headingText; private bool startTracking = false; void Start() { Input.compass.enab... Add solution