calculate impact damage + unity
//This is pulled direclty from the linked url, which is 100% worth a read if,
//like me your ripping this off. Its a great article.
//This is an extension method for calculatin 2d Impact collisions and follow,
//the articles advice: To use this method create a file named
//«Collision2DExtensions.cs» in your project, write
//the previous code inside it and then use collision.GetImpactForce
// in your on collision enter method
public static class Collision2DExtensions {
public static float GetImpactForce (this Collision2D collision) {
float impulse = 0F;
foreach (ContactPoint2D point in collision.contacts) {
impulse += point.normalImpulse;
}
return impulse / Time.fixedDeltaTime;
}
}
Also in C#:
- c# catch two exceptions in one block
- go to next itiration in foreach C#
- conditional compilation c#
- No IUserTwoFactorTokenProvider<TUser> named 'Default' is registered.'
- c# interview questions
- unity 2d detect click on sprite
- c# copy file
- how to access the dictionary from another script in unity
- unity main texture not working
- c# dictionary add
- unity up arrow input
- how to add a list to observablecollection in c#
- zoom gedit
- c# empty array
- wait without pause anything else unity
- visual studio c# mark class deprecated
- : ? conditioanl statement c#
- to list c#
- how to convert float to int c#
- c# connect tcp
- ping with c#
- unity detect any key
- unity how to get data of play session time in a text file?
- mouseposition unity