@@ -105,7 +105,7 @@ public class PredictedRigidbody : NetworkBehaviour
105105 // joints
106106 Vector3 initialPosition ;
107107 Quaternion initialRotation ;
108- Vector3 initialScale ;
108+ // Vector3 initialScale; // don't change scale for now. causes issues with parenting.
109109
110110 void Awake ( )
111111 {
@@ -120,7 +120,7 @@ void Awake()
120120 // cache initial position/rotation/scale to be used when moving physics components (configurable joints' range of motion)
121121 initialPosition = tf . position ;
122122 initialRotation = tf . rotation ;
123- initialScale = tf . localScale ;
123+ // initialScale = tf.localScale;
124124 }
125125
126126 protected virtual void CopyRenderersAsGhost ( GameObject destination , Material material )
@@ -191,17 +191,17 @@ protected virtual void CreateGhosts()
191191 // => remember previous
192192 Vector3 position = tf . position ;
193193 Quaternion rotation = tf . rotation ;
194- Vector3 scale = tf . localScale ;
194+ // Vector3 scale = tf.localScale; // don't change scale for now. causes issues with parenting.
195195 // => reset to initial
196196 physicsGhostRigidbody . transform . position = tf . position = initialPosition ;
197197 physicsGhostRigidbody . transform . rotation = tf . rotation = initialRotation ;
198- physicsGhostRigidbody . transform . localScale = tf . localScale = initialScale ;
198+ physicsGhostRigidbody . transform . localScale = tf . lossyScale ; // world scale! // = initialScale; // don't change scale for now. causes issues with parenting.
199199 // => move physics components
200200 PredictionUtils . MovePhysicsComponents ( gameObject , physicsCopy ) ;
201201 // => reset previous
202202 physicsGhostRigidbody . transform . position = tf . position = position ;
203203 physicsGhostRigidbody . transform . rotation = tf . rotation = rotation ;
204- physicsGhostRigidbody . transform . localScale = tf . localScale = scale ;
204+ // physicsGhostRigidbody.transform.localScale = tf.lossyScale; // world scale! // = scale; // don't change scale for now. causes issues with parenting.
205205
206206 // show ghost by copying all renderers / materials with ghost material applied
207207 if ( showGhost )
@@ -249,7 +249,7 @@ protected virtual void DestroyGhosts()
249249 // => reset to initial
250250 physicsCopy . transform . position = tf . position = initialPosition ;
251251 physicsCopy . transform . rotation = tf . rotation = initialRotation ;
252- physicsCopy . transform . localScale = tf . localScale = initialScale ;
252+ physicsCopy . transform . localScale = tf . lossyScale ; // = initialScale;
253253 // => move physics components
254254 PredictionUtils . MovePhysicsComponents ( physicsCopy , gameObject ) ;
255255 // => reset previous
0 commit comments