mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
Prediction: MovePhysicsComponents helper function
This commit is contained in:
parent
ea13dc67f9
commit
8564e88d97
@ -148,8 +148,7 @@ protected virtual void CreateGhosts()
|
||||
physicsGhostRigidbody.ghostEnabledCheckInterval = ghostEnabledCheckInterval;
|
||||
|
||||
// move the rigidbody component & all colliders to the physics GameObject
|
||||
PredictionUtils.MoveRigidbody(gameObject, physicsCopy);
|
||||
PredictionUtils.MoveAllColliders(gameObject, physicsCopy);
|
||||
PredictionUtils.MovePhysicsComponents(gameObject, physicsCopy);
|
||||
|
||||
// show ghost by copying all renderers / materials with ghost material applied
|
||||
if (showGhost)
|
||||
@ -182,8 +181,7 @@ protected virtual void DestroyCopies()
|
||||
// otherwise next time they wouldn't have a collider anymore.
|
||||
if (physicsCopy != null)
|
||||
{
|
||||
PredictionUtils.MoveRigidbody(physicsCopy, gameObject);
|
||||
PredictionUtils.MoveAllColliders(physicsCopy, gameObject);
|
||||
PredictionUtils.MovePhysicsComponents(physicsCopy, gameObject);
|
||||
Destroy(physicsCopy);
|
||||
}
|
||||
|
||||
|
@ -142,5 +142,12 @@ public static void MoveAllColliders(GameObject source, GameObject destination)
|
||||
MoveCapsuleColliders(source, destination);
|
||||
MoveMeshColliders(source, destination);
|
||||
}
|
||||
|
||||
// move all physics components from one GameObject to another.
|
||||
public static void MovePhysicsComponents(GameObject source, GameObject destination)
|
||||
{
|
||||
MoveRigidbody(source, destination);
|
||||
MoveAllColliders(source, destination);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user