Forwarded from Deleted Account
Media is too big
VIEW IN TELEGRAM
آموزش مه محیطی فیک برای موبایل
#علی_زنجیران
#علی_زنجیران
❤4
using UnityEngine;
public class HeadBobController : MonoBehaviour
{
// Adjust these values in the Inspector to fine-tune the effect
public float amplitude = 0.01f; // The height of the bob
public float frequency = 10.0f; // The speed of the bob
public Transform cameraHolder; // Reference to the CameraHolder GameObject
private Vector3 startPosition;
void Start()
{
// Record the camera's original local position
startPosition = cameraHolder.localPosition;
}
void Update()
{
if (Input.GetAxis("Vertical") != 0)
{
// Use a sine wave to create a smooth, looping bobbing motion
float bobbingAmount = Mathf.Sin(Time.time * frequency) * amplitude;
// Apply the bobbing only to the Y axis (up and down)
cameraHolder.localPosition = startPosition + new Vector3(0, bobbingAmount, 0);
}
else
{
// If not moving, smoothly return the camera to its starting position
cameraHolder.localPosition = Vector3.Lerp(cameraHolder.localPosition, startPosition, Time.deltaTime * frequency);
}
}
}
❤2
آموزش نورپردازی یونیتی ایران
using UnityEngine; public class HeadBobController : MonoBehaviour { // Adjust these values in the Inspector to fine-tune the effect public float amplitude = 0.01f; // The height of the bob public float frequency = 10.0f; // The speed of the bob…
حرکت دوربین (سر کارکتر) با حرکت
HeadBobController
بالا و پایین میشه دوربین... مثلا قدم زدن رو شبیه سازی میکنه
مقدار cameraHolder رو باید پرنت دوربین رو بدید
HeadBobController
بالا و پایین میشه دوربین... مثلا قدم زدن رو شبیه سازی میکنه
مقدار cameraHolder رو باید پرنت دوربین رو بدید
❤3
using UnityEngine;
namespace NewTechnology
{
public class WeaponSway : MonoBehaviour
{
[Header("Sway Settings")]
[HideInInspector] public float smooth = 7f;
[HideInInspector] public float intensity = 1f;
[HideInInspector] public float mouseX;
[HideInInspector] public float mouseY;
public void Update_MouseInput(float x, float y)
{
mouseX = x * intensity;
mouseY = y * intensity / 2;
}
void Update()
{
// calculate target rotation
Quaternion rotationX = Quaternion.AngleAxis(-mouseY, Vector3.right);
Quaternion rotationY = Quaternion.AngleAxis(mouseX, Vector3.up);
Quaternion targetRotation = rotationX * rotationY;
// rotate
transform.localRotation = Quaternion.Slerp(transform.localRotation, targetRotation, smooth * Time.deltaTime);
}
}
}
❤1
آموزش نورپردازی یونیتی ایران
using UnityEngine; namespace NewTechnology { public class WeaponSway : MonoBehaviour { [Header("Sway Settings")] [HideInInspector] public float smooth = 7f; [HideInInspector] public float intensity = 1f; [HideInInspector]…
اینم با چرخش دوربین اسلحه نرم دنبال میکنه دوربین رو بر اساس مقدار MouseX و MouseY باید بهش پاس بدید
این اسکریپت رو بدید به مدل اسلحه
بهش WeaponSway میگن
این اسکریپت رو بدید به مدل اسلحه
بهش WeaponSway میگن
❤4
اسکای باکس رایگان با لایسنس cc0 یعنی واس خودتونه هر کار خواستید کنید:
https://polyhaven.com/hdris/skies
https://polyhaven.com/hdris/skies
Poly Haven
HDRIs • Poly Haven
Previously known as HDRI Haven. Hundreds of free HDRI environments, ready to use for any purpose. No login required.
👍3