Skip to content

Instantly share code, notes, and snippets.

View pppoe252110's full-sized avatar

Artem Kuranakov pppoe252110

  • Parity
View GitHub Profile
using UnityEngine;
namespace SFMeshDeformer.Demo
{
public class BallThrow : MonoBehaviour
{
[SerializeField] private Rigidbody _ballPrefab;
[SerializeField] private float _throwSpeed = 30f;
void Update()
@pppoe252110
pppoe252110 / NoisyFog.shadergraph
Last active June 6, 2024 14:45
URP Only Fullscreen Fog Shader
{
"m_SGVersion": 3,
"m_Type": "UnityEditor.ShaderGraph.GraphData",
"m_ObjectId": "5c145d3ada4f40ea93038af752306c50",
"m_Properties": [
{
"m_Id": "729b6309691e494ca5acf0f0c5c34cf6"
},
{
"m_Id": "c993aca6d4e8473eb4d1795495527359"
@pppoe252110
pppoe252110 / RandomExtension.cs
Last active May 17, 2024 13:06
A random function to determine a random item from a collection with a chance, with the chance being cast to a value between 0 and 1. Example: chance - 0.1 chance - 0.1 chance - 0.2 become chance - 0.25 chance 0.25 chance - 0.5. This makes it possible not to count a certain chance for hundreds of items in a collection
using System;
using UnityEngine;
public static class RandomExtension
{
public static int ProceedValue(float random, RandomData[] data)
{
var cumulativeSumArray = new float[data.Length];
cumulativeSumArray[0] = data[0].chance;
for (int i = 1; i < cumulativeSumArray.Length; ++i)
@pppoe252110
pppoe252110 / WeaponSway.cs
Last active April 28, 2025 13:29
Correct Weapon Sway implementation which does not depend on fps
using UnityEngine;
public class WeaponSway : MonoBehaviour
{
[SerializeField] private Transform weaponTransform;
[Header("Sway Properties")]
[SerializeField] private float swaySmooth = 8f;
[SerializeField] private float swayDamp = 2f;
[SerializeField] private float posToRotAmount = 1f;