"weapon sway unity" Code Answer's
You're definitely familiar with the best coding language Whatever that developers use to develop their projects and they get all their queries like "weapon sway unity" answered properly. Developers are finding an appropriate answer about weapon sway unity related to the Whatever coding language. By visiting this online portal developers get answers concerning Whatever codes question like weapon sway unity. Enter your desired code related query in the search bar and get every piece of information about Whatever code related question on weapon sway unity.
weapon sway unity
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Sway : MonoBehaviour
{
public float intensity;
public float smooth;
private Quaternion origin_rotation;
void Start()
{
origin_rotation = transform.localRotation;
}
void Update()
{
UpdateSway();
}
void UpdateSway()
{
//controls
float t_x_mouse = Input.GetAxis("Mouse X");
float t_y_mouse = Input.GetAxis("Mouse Y");
//calculate target rotation
Quaternion t_x_adj = Quaternion.AngleAxis(-intensity * t_x_mouse, Vector3.up);
Quaternion t_y_adj = Quaternion.AngleAxis(intensity * t_y_mouse, Vector3.right);
Quaternion target_rotation = origin_rotation * t_x_adj * t_y_adj;
transform.localRotation = Quaternion.Lerp(transform.localRotation, target_rotation, Time.deltaTime * smooth);
}
}
All those coders who are working on the Whatever based application and are stuck on weapon sway unity can get a collection of related answers to their query. Programmers need to enter their query on weapon sway unity related to Whatever code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about weapon sway unity for the programmers working on Whatever code while coding their module. Coders are also allowed to rectify already present answers of weapon sway unity while working on the Whatever language code. Developers can add up suggestions if they deem fit any other answer relating to "weapon sway unity". Visit this developer's friendly online web community, CodeProZone, and get your queries like weapon sway unity resolved professionally and stay updated to the latest Whatever updates.