mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
fix(Prediction): disable setting scale for joints since it causes issues with parenting
This commit is contained in:
parent
3cc5aa39c4
commit
8dc4b616c4
@ -105,7 +105,7 @@ public class PredictedRigidbody : NetworkBehaviour
|
|||||||
// joints
|
// joints
|
||||||
Vector3 initialPosition;
|
Vector3 initialPosition;
|
||||||
Quaternion initialRotation;
|
Quaternion initialRotation;
|
||||||
Vector3 initialScale;
|
// Vector3 initialScale; // don't change scale for now. causes issues with parenting.
|
||||||
|
|
||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
@ -120,7 +120,7 @@ void Awake()
|
|||||||
// cache initial position/rotation/scale to be used when moving physics components (configurable joints' range of motion)
|
// cache initial position/rotation/scale to be used when moving physics components (configurable joints' range of motion)
|
||||||
initialPosition = tf.position;
|
initialPosition = tf.position;
|
||||||
initialRotation = tf.rotation;
|
initialRotation = tf.rotation;
|
||||||
initialScale = tf.localScale;
|
// initialScale = tf.localScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void CopyRenderersAsGhost(GameObject destination, Material material)
|
protected virtual void CopyRenderersAsGhost(GameObject destination, Material material)
|
||||||
@ -191,17 +191,17 @@ protected virtual void CreateGhosts()
|
|||||||
// => remember previous
|
// => remember previous
|
||||||
Vector3 position = tf.position;
|
Vector3 position = tf.position;
|
||||||
Quaternion rotation = tf.rotation;
|
Quaternion rotation = tf.rotation;
|
||||||
Vector3 scale = tf.localScale;
|
// Vector3 scale = tf.localScale; // don't change scale for now. causes issues with parenting.
|
||||||
// => reset to initial
|
// => reset to initial
|
||||||
physicsGhostRigidbody.transform.position = tf.position = initialPosition;
|
physicsGhostRigidbody.transform.position = tf.position = initialPosition;
|
||||||
physicsGhostRigidbody.transform.rotation = tf.rotation = initialRotation;
|
physicsGhostRigidbody.transform.rotation = tf.rotation = initialRotation;
|
||||||
physicsGhostRigidbody.transform.localScale = tf.localScale = initialScale;
|
physicsGhostRigidbody.transform.localScale = tf.lossyScale;// world scale! // = initialScale; // don't change scale for now. causes issues with parenting.
|
||||||
// => move physics components
|
// => move physics components
|
||||||
PredictionUtils.MovePhysicsComponents(gameObject, physicsCopy);
|
PredictionUtils.MovePhysicsComponents(gameObject, physicsCopy);
|
||||||
// => reset previous
|
// => reset previous
|
||||||
physicsGhostRigidbody.transform.position = tf.position = position;
|
physicsGhostRigidbody.transform.position = tf.position = position;
|
||||||
physicsGhostRigidbody.transform.rotation = tf.rotation = rotation;
|
physicsGhostRigidbody.transform.rotation = tf.rotation = rotation;
|
||||||
physicsGhostRigidbody.transform.localScale = tf.localScale = scale;
|
//physicsGhostRigidbody.transform.localScale = tf.lossyScale; // world scale! //= scale; // don't change scale for now. causes issues with parenting.
|
||||||
|
|
||||||
// show ghost by copying all renderers / materials with ghost material applied
|
// show ghost by copying all renderers / materials with ghost material applied
|
||||||
if (showGhost)
|
if (showGhost)
|
||||||
@ -249,7 +249,7 @@ protected virtual void DestroyGhosts()
|
|||||||
// => reset to initial
|
// => reset to initial
|
||||||
physicsCopy.transform.position = tf.position = initialPosition;
|
physicsCopy.transform.position = tf.position = initialPosition;
|
||||||
physicsCopy.transform.rotation = tf.rotation = initialRotation;
|
physicsCopy.transform.rotation = tf.rotation = initialRotation;
|
||||||
physicsCopy.transform.localScale = tf.localScale = initialScale;
|
physicsCopy.transform.localScale = tf.lossyScale;// = initialScale;
|
||||||
// => move physics components
|
// => move physics components
|
||||||
PredictionUtils.MovePhysicsComponents(physicsCopy, gameObject);
|
PredictionUtils.MovePhysicsComponents(physicsCopy, gameObject);
|
||||||
// => reset previous
|
// => reset previous
|
||||||
|
Loading…
Reference in New Issue
Block a user