unity how to rotate something to point to something else
Vector3 dir = target.position - transform.position;
Quaternion lookRotation = Quaternion.LookRotation(dir);
Vector3 rotation = Quaternion.Lerp(partToRotate.rotation, lookRotation, Time.deltaTime * turnSpeed).eulerAngles;
partToRotate.rotation = Quaternion.Euler(0f, rotation.y, 0f);
Also in C#:
- unity create primitive
- c# get today's date
- unity make a int arry with preset values
- unity drawline
- add spaces between words unity
- how to convert string to bool c#
- c# textbox tab column
- unity resources load
- unity3d debug pause
- unity face direction of movement
- .net core copy file in folder to root
- c# relaxed boolean cast
- c# multiple catch exceptions
- c# make http request
- random number generator c#
- c# lambda expression
- null coalesce ternary c#
- unity onclick object
- transform object according to its parent unity
- unity find object by name
- the request was aborted could not create ssl/tls secure channel. c# restsharp
- copy a list C#
- c# how to exit program