Beispiel #1
0
        public void PlayParticles(SurfaceOutputs outputs, SurfaceOutput output, Color selfColor, float impulse, Vector3 vel, float mass, float radius = 0, float deltaTime = 0.25f)
        {
#if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                return;
            }
#endif

            Particles[] ps = GetSurfaceParticles(output);

            for (int i = 0; i < ps.Length; i++)
            {
                var p = ps[i];

                var rot      = Quaternion.FromToRotation(Vector3.forward, outputs.hitNormal);
                var otherVel = Utility.GetVelocityMass(outputs.collider.attachedRigidbody, outputs.hitPosition, out Vector3 centerVel1, out float mass1);
                var speed    = (otherVel - vel).magnitude;
                p.particles.GetInstance().PlayParticles
                (
                    p.originType,
                    selfColor, output.color,
                    output.selfParticleMultipliers * p.selfMultipliers, output.otherParticleMultipliers * p.otherMultipliers,
                    1,
                    impulse, speed,
                    rot, outputs.hitPosition, radius, outputs.hitNormal,
                    vel, otherVel,
                    mass, mass1,
                    dt: deltaTime
                );
            }
        }
Beispiel #2
0
        //Methods
        public void CopyTo(SurfaceOutputs to)
        {
            to.Clear();
            to.AddRange(this);

            to.hardness    = hardness;
            to.collider    = collider;
            to.hitPosition = hitPosition;
            to.hitNormal   = hitNormal;
        }
Beispiel #3
0
 //Constructors
 public SurfaceOutputs(SurfaceOutputs so) : base(so)
 {
 }