Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for (int j = 0; j < forcePlates[i].ForceSamples.Length; j++)
- {
- //just to avoid error when ApplicationPoint is NaN
- if (forcePlates[i].ForceSamples[j] != null)
- {
- //just to avoid error when ApplicationPoint is NaN
- if (forcePlates != null
- && forcePlates[i] != null
- && forcePlates[i].ForceSamples != null
- && forcePlates[i].ForceSamples[j] != null
- && forcePlates[i].ForceSamples[j].Force != null
- && forcePlates[i].ForceSamples[j].ApplicationPoint != null
- && forcePlates[i].ForceSamples[j].Moment != null
- && !float.IsNaN(forcePlates[i].ForceSamples[j].Force.sqrMagnitude)
- && !float.IsNaN(forcePlates[i].ForceSamples[j].ApplicationPoint.sqrMagnitude)
- && !float.IsNaN(forcePlates[i].ForceSamples[j].Moment.sqrMagnitude))
- {
- try
- {
- Vector3 force = Vector3.zero;
- lock (forcePlates[i].ForceSamples[j])
- {
- force = (transform.TransformPoint(forcePlates[i].ForceSamples[j].Force) - transform.position) * forceScale;
- }
- Vector3 moment = Vector3.zero;
- lock (forcePlates[i].ForceSamples[j])
- {
- moment = transform.TransformPoint(forcePlates[i].ForceSamples[j].Moment);
- }
- Vector3 COP = Vector3.zero;
- lock (forcePlates[i].ForceSamples[j])
- {
- COP = transform.TransformPoint(forcePlates[i].ForceSamples[j].ApplicationPoint) - transform.position;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement