Skip to content

Commit a1da974

Browse files
committed
Stop movement using impulses for non-local players, for each player show its own canvas
1 parent 27af3a4 commit a1da974

File tree

2 files changed

+42
-35
lines changed

2 files changed

+42
-35
lines changed

Assets/Project/Prefabs/Player.prefab

Lines changed: 38 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,6 +1339,7 @@ GameObject:
13391339
- component: {fileID: 281127601418312251}
13401340
- component: {fileID: 3639536930002975250}
13411341
- component: {fileID: 7833006461627595125}
1342+
- component: {fileID: 1181971906093917397}
13421343
m_Layer: 0
13431344
m_Name: Ball
13441345
m_TagString: Player
@@ -1572,6 +1573,43 @@ MonoBehaviour:
15721573
m_Name:
15731574
m_EditorClassIdentifier:
15741575
threshold: 10
1576+
--- !u!114 &1181971906093917397
1577+
MonoBehaviour:
1578+
m_ObjectHideFlags: 0
1579+
m_CorrespondingSourceObject: {fileID: 0}
1580+
m_PrefabInstance: {fileID: 0}
1581+
m_PrefabAsset: {fileID: 0}
1582+
m_GameObject: {fileID: 3304751284562327703}
1583+
m_Enabled: 1
1584+
m_EditorHideFlags: 0
1585+
m_Script: {fileID: 11500000, guid: d38927cdc6024b9682b5fe9778b9ef99, type: 3}
1586+
m_Name:
1587+
m_EditorClassIdentifier:
1588+
syncDirection: 0
1589+
syncMode: 0
1590+
syncInterval: 0
1591+
predictedRigidbody: {fileID: 1333073185178226399}
1592+
mode: 0
1593+
motionSmoothingVelocityThreshold: 0.1
1594+
motionSmoothingAngularVelocityThreshold: 5
1595+
motionSmoothingTimeTolerance: 0.5
1596+
stateHistoryLimit: 32
1597+
recordInterval: 0.05
1598+
onlyRecordChanges: 1
1599+
compareLastFirst: 1
1600+
positionCorrectionThreshold: 0.1
1601+
rotationCorrectionThreshold: 5
1602+
oneFrameAhead: 1
1603+
snapThreshold: 2
1604+
showGhost: 1
1605+
ghostVelocityThreshold: 0.1
1606+
localGhostMaterial: {fileID: 2100000, guid: 411a48b4a197d4924bec3e3809bc9320, type: 2}
1607+
remoteGhostMaterial: {fileID: 2100000, guid: 04f0b2088c857414393bab3b80356776, type: 2}
1608+
checkGhostsEveryNthFrame: 4
1609+
positionInterpolationSpeed: 15
1610+
rotationInterpolationSpeed: 10
1611+
teleportDistanceMultiplier: 10
1612+
reduceSendsWhileIdle: 1
15751613
--- !u!1 &3789033811130807208
15761614
GameObject:
15771615
m_ObjectHideFlags: 0
@@ -2849,7 +2887,6 @@ GameObject:
28492887
m_Component:
28502888
- component: {fileID: 7562962934770653945}
28512889
- component: {fileID: 9072691929066640156}
2852-
- component: {fileID: 3660766092118942287}
28532890
- component: {fileID: 2432340312607300879}
28542891
- component: {fileID: 1979509002215640469}
28552892
- component: {fileID: 2691374847498297769}
@@ -2900,39 +2937,6 @@ MonoBehaviour:
29002937
serverOnly: 0
29012938
visibility: 0
29022939
hasSpawned: 0
2903-
--- !u!114 &3660766092118942287
2904-
MonoBehaviour:
2905-
m_ObjectHideFlags: 0
2906-
m_CorrespondingSourceObject: {fileID: 0}
2907-
m_PrefabInstance: {fileID: 0}
2908-
m_PrefabAsset: {fileID: 0}
2909-
m_GameObject: {fileID: 7562962934770653944}
2910-
m_Enabled: 1
2911-
m_EditorHideFlags: 0
2912-
m_Script: {fileID: 11500000, guid: 8ff3ba0becae47b8b9381191598957c8, type: 3}
2913-
m_Name:
2914-
m_EditorClassIdentifier:
2915-
syncDirection: 1
2916-
syncMode: 0
2917-
syncInterval: 0
2918-
target: {fileID: 7562962934770653945}
2919-
syncPosition: 1
2920-
syncRotation: 1
2921-
syncScale: 1
2922-
onlySyncOnChange: 1
2923-
compressRotation: 1
2924-
interpolatePosition: 1
2925-
interpolateRotation: 1
2926-
interpolateScale: 1
2927-
coordinateSpace: 0
2928-
timelineOffset: 1
2929-
showGizmos: 1
2930-
showOverlay: 0
2931-
overlayColor: {r: 0, g: 0, b: 0, a: 0.5}
2932-
onlySyncOnChangeCorrectionMultiplier: 2
2933-
rotationSensitivity: 0.01
2934-
positionPrecision: 0.01
2935-
scalePrecision: 0.01
29362940
--- !u!114 &2432340312607300879
29372941
MonoBehaviour:
29382942
m_ObjectHideFlags: 0

Assets/Project/Scripts/Internet/PlayerController.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ private void CachePosition(InputAction.CallbackContext context)
8484

8585
private void UseCachedPosition(InputAction.CallbackContext context)
8686
{
87-
if (!_tapPlayer) return;
87+
if (!_tapPlayer || !isLocalPlayer) return;
8888
var difference = _cachedPosition - _input.Game.Position.ReadValue<Vector2>();
8989

9090
// Change #3: determine direction of impulse based on ball's position
@@ -152,6 +152,9 @@ private void Start()
152152
{
153153
_pickUps = GetComponent<PickUpsController>();
154154
_quantities = GetComponent<QuantityController>();
155+
156+
if (!isLocalPlayer)
157+
GetComponentInChildren<Canvas>().gameObject.SetActive(false);
155158
}
156159

157160
/* Make "Main Camera" on a scene follow player ball, as it's suggested in:

0 commit comments

Comments
 (0)