mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2025-02-17 05:18:27 +00:00
destroy all rigid bodies on clients except for the root bone - they work for themselves, and bones look deformed and stretched
This commit is contained in:
parent
d525a99575
commit
6f21cc8bf0
2 changed files with 13 additions and 0 deletions
|
@ -124,6 +124,13 @@ namespace SanAndreasUnity.Behaviours.Peds
|
|||
|
||||
m_framesDict = model.Frames.ToDictionary(f => f.BoneId, f => new BoneInfo(f.transform));
|
||||
|
||||
// destroy all rigid bodies except for the root bone - they work for themselves, and bones look deformed and stretched
|
||||
m_framesDict
|
||||
.Where(pair => pair.Key != 0)
|
||||
.Select(pair => pair.Value.Rigidbody)
|
||||
.WhereAlive()
|
||||
.ForEach(Object.Destroy);
|
||||
|
||||
Object.Destroy(model.AnimComponent);
|
||||
Object.Destroy(model);
|
||||
|
||||
|
|
|
@ -563,6 +563,12 @@ namespace SanAndreasUnity.Utilities
|
|||
}
|
||||
}
|
||||
|
||||
public static IEnumerable<T> WhereAlive<T> (this IEnumerable<T> enumerable)
|
||||
where T : UnityEngine.Object
|
||||
{
|
||||
return enumerable.Where(obj => obj != null);
|
||||
}
|
||||
|
||||
public static int RemoveDeadObjects<T> (this List<T> list) where T : UnityEngine.Object
|
||||
{
|
||||
return list.RemoveAll(item => null == item);
|
||||
|
|
Loading…
Add table
Reference in a new issue