Created
December 21, 2016 04:40
-
-
Save runewake2/2256a3d77724e3606743d7f07f734280 to your computer and use it in GitHub Desktop.
Physics based mesh deformation. This is the physics system.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment