Add PhysicsSyncer to fix setting transform.position on Player
This commit is contained in:
parent
5887757d5c
commit
73b1613be8
@ -4267,7 +4267,7 @@ Transform:
|
|||||||
- {fileID: 1734890299}
|
- {fileID: 1734890299}
|
||||||
- {fileID: 529416814}
|
- {fileID: 529416814}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 5
|
m_RootOrder: 6
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &205498803
|
--- !u!1 &205498803
|
||||||
GameObject:
|
GameObject:
|
||||||
@ -5155,7 +5155,7 @@ Transform:
|
|||||||
- {fileID: 1533302259}
|
- {fileID: 1533302259}
|
||||||
- {fileID: 129354770}
|
- {fileID: 129354770}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 2
|
m_RootOrder: 3
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &529416811
|
--- !u!1 &529416811
|
||||||
GameObject:
|
GameObject:
|
||||||
@ -8623,7 +8623,7 @@ PrefabInstance:
|
|||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 1618967478166023428, guid: e3d975a8d1b28eb4b9f646262c56653d, type: 3}
|
- target: {fileID: 1618967478166023428, guid: e3d975a8d1b28eb4b9f646262c56653d, type: 3}
|
||||||
propertyPath: m_RootOrder
|
propertyPath: m_RootOrder
|
||||||
value: 8
|
value: 9
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 1618967478166023428, guid: e3d975a8d1b28eb4b9f646262c56653d, type: 3}
|
- target: {fileID: 1618967478166023428, guid: e3d975a8d1b28eb4b9f646262c56653d, type: 3}
|
||||||
propertyPath: m_LocalEulerAnglesHint.x
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
@ -8739,6 +8739,49 @@ Light:
|
|||||||
m_UseBoundingSphereOverride: 0
|
m_UseBoundingSphereOverride: 0
|
||||||
m_ShadowRadius: 0
|
m_ShadowRadius: 0
|
||||||
m_ShadowAngle: 0
|
m_ShadowAngle: 0
|
||||||
|
--- !u!1 &1002460576
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1002460577}
|
||||||
|
- component: {fileID: 1002460578}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: PhysicsSyncer
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &1002460577
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1002460576}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_RootOrder: 1
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &1002460578
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1002460576}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 0f9e0806aba752c4aa853edd1ff03fda, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
--- !u!1 &1022355506
|
--- !u!1 &1022355506
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -9936,7 +9979,7 @@ Transform:
|
|||||||
- {fileID: 594137574}
|
- {fileID: 594137574}
|
||||||
- {fileID: 1609014458}
|
- {fileID: 1609014458}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 3
|
m_RootOrder: 4
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &1104743577
|
--- !u!1 &1104743577
|
||||||
GameObject:
|
GameObject:
|
||||||
@ -10496,7 +10539,7 @@ Transform:
|
|||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 7
|
m_RootOrder: 8
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
|
||||||
--- !u!1 &1210745934
|
--- !u!1 &1210745934
|
||||||
GameObject:
|
GameObject:
|
||||||
@ -12749,7 +12792,7 @@ Transform:
|
|||||||
- {fileID: 1870782421}
|
- {fileID: 1870782421}
|
||||||
- {fileID: 1220168323}
|
- {fileID: 1220168323}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 4
|
m_RootOrder: 5
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &1494157025
|
--- !u!1 &1494157025
|
||||||
GameObject:
|
GameObject:
|
||||||
@ -17407,7 +17450,7 @@ Transform:
|
|||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 1
|
m_RootOrder: 2
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &1756963543
|
--- !u!1 &1756963543
|
||||||
GameObject:
|
GameObject:
|
||||||
@ -18761,7 +18804,7 @@ PrefabInstance:
|
|||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 1599217288880773178, guid: 1a03b85f19189674187c9966f5f557e3, type: 3}
|
- target: {fileID: 1599217288880773178, guid: 1a03b85f19189674187c9966f5f557e3, type: 3}
|
||||||
propertyPath: m_RootOrder
|
propertyPath: m_RootOrder
|
||||||
value: 6
|
value: 7
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 1599217288880773178, guid: 1a03b85f19189674187c9966f5f557e3, type: 3}
|
- target: {fileID: 1599217288880773178, guid: 1a03b85f19189674187c9966f5f557e3, type: 3}
|
||||||
propertyPath: m_LocalEulerAnglesHint.x
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
|
@ -124,6 +124,9 @@ namespace NeonTea.Quakeball.Players {
|
|||||||
private void Awake() {
|
private void Awake() {
|
||||||
CharacterController = GetComponent<CharacterController>();
|
CharacterController = GetComponent<CharacterController>();
|
||||||
FeetPosition = transform.position + CharacterController.center - Vector3.up * (CharacterController.height / 2 + CharacterController.skinWidth / 2);
|
FeetPosition = transform.position + CharacterController.center - Vector3.up * (CharacterController.height / 2 + CharacterController.skinWidth / 2);
|
||||||
|
if (GameObject.FindObjectOfType<Util.PhysicsSyncer>() == null) {
|
||||||
|
Debug.LogWarning("Player.Awake: There is no PhysicsSyncer in this scene! Some code will not work as expected.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Update() {
|
private void Update() {
|
||||||
|
11
Assets/Scripts/Util/PhysicsSyncer.cs
Normal file
11
Assets/Scripts/Util/PhysicsSyncer.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace NeonTea.Quakeball.Util {
|
||||||
|
public class PhysicsSyncer : MonoBehaviour {
|
||||||
|
private void Update() {
|
||||||
|
Physics.SyncTransforms();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Scripts/Util/PhysicsSyncer.cs.meta
Normal file
11
Assets/Scripts/Util/PhysicsSyncer.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0f9e0806aba752c4aa853edd1ff03fda
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 50
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Loading…
Reference in New Issue
Block a user