Skip to content

Instantly share code, notes, and snippets.

@runewake2
Created December 21, 2016 04:40
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save runewake2/2256a3d77724e3606743d7f07f734280 to your computer and use it in GitHub Desktop.
Save runewake2/2256a3d77724e3606743d7f07f734280 to your computer and use it in GitHub Desktop.

Revisions

  1. runewake2 created this gist Dec 21, 2016.
    27 changes: 27 additions & 0 deletions PhysicsDeformer.cs
    @@ -0,0 +1,27 @@
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;

    public class PhysicsDeformer : MonoBehaviour {

    public float collisionRadius = 0.1f;
    public DeformableMesh deformableMesh;

    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {

    }

    void OnCollisionStay(Collision collision)
    {
    foreach (var contact in collision.contacts)
    {
    deformableMesh.AddDepression(contact.point, collisionRadius);
    }
    }
    }