mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
Pickup Party, Physics! Part 3
This commit is contained in:
parent
562f18d3f5
commit
24b5dab61c
2
.gitignore
vendored
2
.gitignore
vendored
@ -81,3 +81,5 @@ Thumbs.db
|
|||||||
|
|
||||||
# CompilationLog.txt created by tests
|
# CompilationLog.txt created by tests
|
||||||
Assets/Mirror/Tests/Editor/Weaver/*/CompilationLog.txt
|
Assets/Mirror/Tests/Editor/Weaver/*/CompilationLog.txt
|
||||||
|
Assets/Mirage*
|
||||||
|
Assets/ParrelSync*
|
||||||
|
@ -0,0 +1,135 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &3350161566424659706
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1357295079658837445}
|
||||||
|
- component: {fileID: 6414208444886493924}
|
||||||
|
- component: {fileID: 7067323468124357061}
|
||||||
|
- component: {fileID: 4167309113991024219}
|
||||||
|
- component: {fileID: 1373717341218114730}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: PickupObject
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &1357295079658837445
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 3350161566424659706}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
|
m_LocalPosition: {x: 2.6, y: -0.41, z: 2.7}
|
||||||
|
m_LocalScale: {x: 0.5, y: 1, z: 0.5}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!33 &6414208444886493924
|
||||||
|
MeshFilter:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 3350161566424659706}
|
||||||
|
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
--- !u!23 &7067323468124357061
|
||||||
|
MeshRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 3350161566424659706}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_CastShadows: 1
|
||||||
|
m_ReceiveShadows: 1
|
||||||
|
m_DynamicOccludee: 1
|
||||||
|
m_StaticShadowCaster: 0
|
||||||
|
m_MotionVectors: 1
|
||||||
|
m_LightProbeUsage: 1
|
||||||
|
m_ReflectionProbeUsage: 1
|
||||||
|
m_RayTracingMode: 2
|
||||||
|
m_RayTraceProcedural: 0
|
||||||
|
m_RenderingLayerMask: 1
|
||||||
|
m_RendererPriority: 0
|
||||||
|
m_Materials:
|
||||||
|
- {fileID: 2100000, guid: 45d1084478c6d423da655089775d56a2, type: 2}
|
||||||
|
m_StaticBatchInfo:
|
||||||
|
firstSubMesh: 0
|
||||||
|
subMeshCount: 0
|
||||||
|
m_StaticBatchRoot: {fileID: 0}
|
||||||
|
m_ProbeAnchor: {fileID: 0}
|
||||||
|
m_LightProbeVolumeOverride: {fileID: 0}
|
||||||
|
m_ScaleInLightmap: 1
|
||||||
|
m_ReceiveGI: 1
|
||||||
|
m_PreserveUVs: 0
|
||||||
|
m_IgnoreNormalsForChartDetection: 0
|
||||||
|
m_ImportantGI: 0
|
||||||
|
m_StitchLightmapSeams: 1
|
||||||
|
m_SelectedEditorRenderState: 3
|
||||||
|
m_MinimumChartSize: 4
|
||||||
|
m_AutoUVMaxDistance: 0.5
|
||||||
|
m_AutoUVMaxAngle: 89
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_SortingLayerID: 0
|
||||||
|
m_SortingLayer: 0
|
||||||
|
m_SortingOrder: 0
|
||||||
|
m_AdditionalVertexStreams: {fileID: 0}
|
||||||
|
--- !u!65 &4167309113991024219
|
||||||
|
BoxCollider:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 3350161566424659706}
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_IncludeLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 0
|
||||||
|
m_ExcludeLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 0
|
||||||
|
m_LayerOverridePriority: 0
|
||||||
|
m_IsTrigger: 0
|
||||||
|
m_ProvidesContacts: 0
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 3
|
||||||
|
m_Size: {x: 1, y: 1, z: 1}
|
||||||
|
m_Center: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!54 &1373717341218114730
|
||||||
|
Rigidbody:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 3350161566424659706}
|
||||||
|
serializedVersion: 4
|
||||||
|
m_Mass: 1
|
||||||
|
m_Drag: 0.05
|
||||||
|
m_AngularDrag: 0.05
|
||||||
|
m_CenterOfMass: {x: 0, y: 0, z: 0}
|
||||||
|
m_InertiaTensor: {x: 1, y: 1, z: 1}
|
||||||
|
m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_IncludeLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 0
|
||||||
|
m_ExcludeLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 0
|
||||||
|
m_ImplicitCom: 1
|
||||||
|
m_ImplicitTensor: 1
|
||||||
|
m_UseGravity: 1
|
||||||
|
m_IsKinematic: 0
|
||||||
|
m_Interpolate: 0
|
||||||
|
m_Constraints: 0
|
||||||
|
m_CollisionDetection: 1
|
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ab3b3f71325c24893869dd9f6c9bf556
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -609,6 +609,7 @@ GameObject:
|
|||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 6299839938573537759}
|
- component: {fileID: 6299839938573537759}
|
||||||
|
- component: {fileID: 1325586932094605749}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: PlayerArmPivotL
|
m_Name: PlayerArmPivotL
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@ -633,6 +634,41 @@ Transform:
|
|||||||
- {fileID: 3871552658736460632}
|
- {fileID: 3871552658736460632}
|
||||||
m_Father: {fileID: 3982489895616607845}
|
m_Father: {fileID: 3982489895616607845}
|
||||||
m_LocalEulerAnglesHint: {x: -45, y: -90, z: 0}
|
m_LocalEulerAnglesHint: {x: -45, y: -90, z: 0}
|
||||||
|
--- !u!114 &1325586932094605749
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 3337348122071847668}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: a553cb17010b2403e8523b558bffbc14, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
syncDirection: 1
|
||||||
|
syncMode: 0
|
||||||
|
syncInterval: 0
|
||||||
|
target: {fileID: 6299839938573537759}
|
||||||
|
syncPosition: 0
|
||||||
|
syncRotation: 1
|
||||||
|
syncScale: 0
|
||||||
|
onlySyncOnChange: 1
|
||||||
|
compressRotation: 1
|
||||||
|
interpolatePosition: 1
|
||||||
|
interpolateRotation: 1
|
||||||
|
interpolateScale: 0
|
||||||
|
coordinateSpace: 0
|
||||||
|
sendIntervalMultiplier: 3
|
||||||
|
timelineOffset: 0
|
||||||
|
showGizmos: 0
|
||||||
|
showOverlay: 0
|
||||||
|
overlayColor: {r: 0, g: 0, b: 0, a: 0.5}
|
||||||
|
bufferResetMultiplier: 6
|
||||||
|
changedDetection: 1
|
||||||
|
positionSensitivity: 0.01
|
||||||
|
rotationSensitivity: 0.5
|
||||||
|
scaleSensitivity: 0.01
|
||||||
--- !u!1 &3505744635913726724
|
--- !u!1 &3505744635913726724
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -792,7 +828,7 @@ MonoBehaviour:
|
|||||||
compressRotation: 1
|
compressRotation: 1
|
||||||
interpolatePosition: 1
|
interpolatePosition: 1
|
||||||
interpolateRotation: 1
|
interpolateRotation: 1
|
||||||
interpolateScale: 1
|
interpolateScale: 0
|
||||||
coordinateSpace: 0
|
coordinateSpace: 0
|
||||||
sendIntervalMultiplier: 3
|
sendIntervalMultiplier: 3
|
||||||
timelineOffset: 0
|
timelineOffset: 0
|
||||||
@ -862,7 +898,7 @@ MonoBehaviour:
|
|||||||
playerArmSlots:
|
playerArmSlots:
|
||||||
- {fileID: 3397797976900785828}
|
- {fileID: 3397797976900785828}
|
||||||
- {fileID: 1009485556880835443}
|
- {fileID: 1009485556880835443}
|
||||||
freezeRBrotation: 1
|
freezePositionRB: 1
|
||||||
characterController: {fileID: 4117093369808553598}
|
characterController: {fileID: 4117093369808553598}
|
||||||
--- !u!1 &5473584597135620801
|
--- !u!1 &5473584597135620801
|
||||||
GameObject:
|
GameObject:
|
||||||
@ -1160,6 +1196,7 @@ GameObject:
|
|||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 2672433250560454}
|
- component: {fileID: 2672433250560454}
|
||||||
|
- component: {fileID: 7204149903870050621}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: PlayerArmPivotR
|
m_Name: PlayerArmPivotR
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@ -1184,6 +1221,41 @@ Transform:
|
|||||||
- {fileID: 6532467146160453607}
|
- {fileID: 6532467146160453607}
|
||||||
m_Father: {fileID: 3982489895616607845}
|
m_Father: {fileID: 3982489895616607845}
|
||||||
m_LocalEulerAnglesHint: {x: -45, y: 90, z: 0}
|
m_LocalEulerAnglesHint: {x: -45, y: 90, z: 0}
|
||||||
|
--- !u!114 &7204149903870050621
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 8085302157987762566}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: a553cb17010b2403e8523b558bffbc14, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
syncDirection: 1
|
||||||
|
syncMode: 0
|
||||||
|
syncInterval: 0
|
||||||
|
target: {fileID: 2672433250560454}
|
||||||
|
syncPosition: 0
|
||||||
|
syncRotation: 1
|
||||||
|
syncScale: 0
|
||||||
|
onlySyncOnChange: 1
|
||||||
|
compressRotation: 1
|
||||||
|
interpolatePosition: 1
|
||||||
|
interpolateRotation: 1
|
||||||
|
interpolateScale: 0
|
||||||
|
coordinateSpace: 0
|
||||||
|
sendIntervalMultiplier: 3
|
||||||
|
timelineOffset: 0
|
||||||
|
showGizmos: 0
|
||||||
|
showOverlay: 0
|
||||||
|
overlayColor: {r: 0, g: 0, b: 0, a: 0.5}
|
||||||
|
bufferResetMultiplier: 6
|
||||||
|
changedDetection: 1
|
||||||
|
positionSensitivity: 0.01
|
||||||
|
rotationSensitivity: 0.5
|
||||||
|
scaleSensitivity: 0.01
|
||||||
--- !u!1 &8909848922143598225
|
--- !u!1 &8909848922143598225
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -14,11 +14,11 @@ public class PlayerPickupParty : NetworkBehaviour
|
|||||||
private float verticalSpeed = 0f;
|
private float verticalSpeed = 0f;
|
||||||
public float armRotationSpeed = 25f;
|
public float armRotationSpeed = 25f;
|
||||||
public bool canPickup = false;
|
public bool canPickup = false;
|
||||||
public Transform[] pickedUpObjects; // acts like inventory slots
|
public Transform[] pickedUpObjects; // store pickups like an inventory
|
||||||
public Rigidbody[] pickedUpRigidbodies; // cache pickups
|
public Rigidbody[] pickedUpRigidbodies; // cache pickups to avoid re-referencing and get components
|
||||||
public Transform[] armPivots; // acts like inventory slots
|
public Transform[] armPivots; // acts like inventory slots
|
||||||
public PlayerArmSlot[] playerArmSlots; // acts like inventory slots
|
public PlayerArmSlot[] playerArmSlots; // acts like inventory slots
|
||||||
public bool freezeRBrotation = true;
|
public bool freezeRotationRB = true; // if false, picked up objects rotate with collision
|
||||||
|
|
||||||
public CharacterController characterController;
|
public CharacterController characterController;
|
||||||
private Camera mainCamera;
|
private Camera mainCamera;
|
||||||
@ -93,8 +93,6 @@ void PlayerMovement()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if !UNITY_SERVER
|
#if !UNITY_SERVER
|
||||||
[ClientCallback]
|
[ClientCallback]
|
||||||
void RotatePlayerToMouse()
|
void RotatePlayerToMouse()
|
||||||
@ -152,9 +150,9 @@ void Pickup()
|
|||||||
pickedUpObjects[slotActive].SetParent(armPivots[slotActive]);
|
pickedUpObjects[slotActive].SetParent(armPivots[slotActive]);
|
||||||
//pickedUpObjectRigidbody.isKinematic = true;
|
//pickedUpObjectRigidbody.isKinematic = true;
|
||||||
pickedUpRigidbodies[slotActive].useGravity = false;
|
pickedUpRigidbodies[slotActive].useGravity = false;
|
||||||
if (freezeRBrotation)
|
if (freezeRotationRB)
|
||||||
{
|
{
|
||||||
pickedUpRigidbodies[slotActive].constraints = RigidbodyConstraints.FreezePosition;
|
pickedUpRigidbodies[slotActive].constraints = RigidbodyConstraints.FreezeRotation;
|
||||||
}
|
}
|
||||||
playerArmSlots[slotActive].triggerCollider.enabled = false;
|
playerArmSlots[slotActive].triggerCollider.enabled = false;
|
||||||
canPickup = false;
|
canPickup = false;
|
||||||
@ -164,7 +162,7 @@ void Pickup()
|
|||||||
pickedUpObjects[slotActive].SetParent(null);
|
pickedUpObjects[slotActive].SetParent(null);
|
||||||
//pickedUpObjectRigidbody.isKinematic = false;
|
//pickedUpObjectRigidbody.isKinematic = false;
|
||||||
pickedUpRigidbodies[slotActive].useGravity = true;
|
pickedUpRigidbodies[slotActive].useGravity = true;
|
||||||
if (freezeRBrotation)
|
if (freezeRotationRB)
|
||||||
{
|
{
|
||||||
pickedUpRigidbodies[slotActive].constraints = RigidbodyConstraints.None;
|
pickedUpRigidbodies[slotActive].constraints = RigidbodyConstraints.None;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user