Skip to content

Feat: Pickup Ingredient Animation #70

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 59 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
af30a9e
update clientdriven sample to 2021.3.12f1
fernando-cortez Nov 2, 2022
68d3842
third person controller assets added
fernando-cortez Nov 2, 2022
030f1e1
dependencies updated
fernando-cortez Nov 2, 2022
78d6b8d
update to NGO 1.0.2
fernando-cortez Nov 3, 2022
25b5023
Merge branch 'chore/clientdriven-LTS-update' into feat/third-person-c…
fernando-cortez Nov 3, 2022
dcfae3a
Merge branch 'feat/third-person-character-controller-assets' into fea…
fernando-cortez Nov 3, 2022
e68b5d4
integration of networked third person character avatar
fernando-cortez Nov 3, 2022
5fb1b9d
using NGO 1.1.0
fernando-cortez Nov 3, 2022
8b9638d
Merge branch 'chore/clientdriven-LTS-update' into feat/third-person-c…
fernando-cortez Nov 3, 2022
67a8371
Merge branch 'feat/third-person-character-controller-assets' into fea…
fernando-cortez Nov 3, 2022
d2a1e60
Merge branch 'develop' into feat/third-person-character-controller-in…
fernando-cortez Nov 4, 2022
1f93e65
WIP targeting Boss Room's utility package commit for ClientNetworkAni…
fernando-cortez Nov 7, 2022
e8086ab
IP window allows for custom IP using UI Toolkit, player apply force r…
fernando-cortez Nov 9, 2022
646ec6f
Merge branch 'develop' into feat/third-person-character-controller-in…
fernando-cortez Nov 9, 2022
1a3868d
feedback: non-alloc raycasts, less spawns, format, etc
fernando-cortez Nov 10, 2022
0a512a1
Merge branch 'develop' into feat/third-person-character-controller-in…
fernando-cortez Nov 10, 2022
dfb8a8f
removing motionspeed animation speed multiplier
fernando-cortez Nov 15, 2022
8af7cc8
player spawned after spawn points are consumed is spawned at world or…
fernando-cortez Nov 15, 2022
013f40a
Implementation of pick up animation
jilfranco-unity Nov 17, 2022
e158d2d
feedback on formatting & interactivity
fernando-cortez Nov 17, 2022
8a5a4e6
changlog addition, more feedback changes
fernando-cortez Nov 21, 2022
a1561ab
Merge branch 'develop' into feat/third-person-character-controller-in…
fernando-cortez Nov 21, 2022
c2858a2
MTT stamps for thirdpersoncontroller script
fernando-cortez Nov 21, 2022
5999a81
reordering when iskinematic is enabled
fernando-cortez Nov 21, 2022
c343266
Blend tree tweaks
jilfranco-unity Nov 21, 2022
adca75c
Some animation tweaks and added a line to fix the bug of the players …
jilfranco-unity Nov 22, 2022
0f1e5e2
capsule collider added to ghost players, ingredient is dropped overhead
fernando-cortez Nov 28, 2022
b7cee80
ground layer usage
fernando-cortez Nov 28, 2022
58d43c7
stove collider upsize
fernando-cortez Nov 28, 2022
e123a61
restoring drop overhead, removing fixedupdate usage
fernando-cortez Nov 29, 2022
d37c360
renaming
fernando-cortez Nov 29, 2022
752a067
re-enabling footstep sound on ghost clients
fernando-cortez Nov 30, 2022
7a2e4df
Minor changes to the blending and position offsets to the carrying an…
jilfranco-unity Nov 30, 2022
f0d9ebc
Merge branch 'feat/third-person-character-controller-integration-IP-U…
jilfranco-unity Nov 30, 2022
55ca074
more description on MTT usage
fernando-cortez Nov 30, 2022
0484478
re-added MotionSpeed functionality, any mapping can apply input (inpu…
fernando-cortez Nov 30, 2022
5ac491e
Merge branch 'feat/third-person-character-controller-integration-IP-U…
jilfranco-unity Nov 30, 2022
231f2d3
comment feedback
fernando-cortez Nov 30, 2022
df674b7
pickup height bumped up
fernando-cortez Dec 1, 2022
b9c8b8e
Merge branch 'feat/third-person-character-controller-integration-IP-U…
jilfranco-unity Dec 1, 2022
1c23a16
merge develop, fixing in-scene geometry & spawn points
fernando-cortez Dec 1, 2022
1d77288
removing ingredients in level
fernando-cortez Dec 1, 2022
2cc1bf1
Merge branch 'feat/third-person-character-controller-integration-IP-U…
jilfranco-unity Dec 2, 2022
62ddb88
documenting NGO workaround to set in-scene NetworkVariable starting v…
fernando-cortez Dec 2, 2022
3c28044
dropzone prefab scale correction
fernando-cortez Dec 2, 2022
e0a2415
removing old host/join component, player motionspeed default param se…
fernando-cortez Dec 2, 2022
b4abf9d
Merge branch 'develop' into feat/third-person-character-controller-in…
fernando-cortez Dec 2, 2022
636cc54
removing workaround on networkvariables on in-scene placed NetworkObj…
fernando-cortez Dec 5, 2022
c4fc966
updating the project to 2021.3.15f1
fernando-cortez Dec 5, 2022
796ac30
adding rigidbody interpolation to the ingredient prefabs
fernando-cortez Dec 5, 2022
08ad4e0
turning off interpolation while object is picked up
fernando-cortez Dec 6, 2022
99f0af6
Merge branch 'feat/third-person-character-controller-integration-IP-U…
jilfranco-unity Dec 6, 2022
fd41ada
Merge branch 'develop' into feat/pickup-animation
jilfranco-unity Dec 6, 2022
a2ffd8a
added a socket for the ingredient so the player can pick it up in fro…
jilfranco-unity Dec 7, 2022
7744768
Added in fix for dropzones not making clients drop arms after droppin…
jilfranco-unity Dec 7, 2022
37c5bef
Merge branch 'develop' into feat/pickup-animation
SamuelBellomo Dec 7, 2022
75dccc7
Merge branch 'develop' into feat/pickup-animation
jilfranco-unity Dec 7, 2022
33f5397
Some code formatting, as well as some cleanup of code re added by mis…
jilfranco-unity Dec 7, 2022
f5386de
Deletion of an old unused variable
jilfranco-unity Dec 7, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion Basic/ClientDriven/Assets/Prefabs/Dropzone.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 25b7be589cd61419ca00249e2c87d8c7, type: 3}
m_Name:
m_EditorClassIdentifier:
m_StartingIngredientType: 0
currentIngredientType:
m_InternalValue: 0
m_ScoreTracker: {fileID: 11400000, guid: 9accfd676684d4f479855e480c5e372f, type: 2}
Expand Down Expand Up @@ -504,6 +503,18 @@ PrefabInstance:
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 4621998539424734916, guid: a6b33b41508134c09957e076f4d53415, type: 3}
propertyPath: m_LocalScale.x
value: 0.6
objectReference: {fileID: 0}
- target: {fileID: 4621998539424734916, guid: a6b33b41508134c09957e076f4d53415, type: 3}
propertyPath: m_LocalScale.y
value: 0.6
objectReference: {fileID: 0}
- target: {fileID: 4621998539424734916, guid: a6b33b41508134c09957e076f4d53415, type: 3}
propertyPath: m_LocalScale.z
value: 0.6
objectReference: {fileID: 0}
- target: {fileID: 4621998539424734916, guid: a6b33b41508134c09957e076f4d53415, type: 3}
propertyPath: m_LocalPosition.x
value: 0
Expand Down Expand Up @@ -544,6 +555,10 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: -45.299
objectReference: {fileID: 0}
- target: {fileID: 4621998539424734916, guid: a6b33b41508134c09957e076f4d53415, type: 3}
propertyPath: m_ConstrainProportionsScale
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5818429371130516787, guid: a6b33b41508134c09957e076f4d53415, type: 3}
propertyPath: GlobalObjectIdHash
value: 4010928100
Expand Down
22 changes: 20 additions & 2 deletions Basic/ClientDriven/Assets/Prefabs/Ingredient.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ GameObject:
- component: {fileID: 5818429371130516787}
- component: {fileID: 5607146804455042385}
- component: {fileID: 2549828380439460752}
- component: {fileID: 8102146958862450613}
m_Layer: 6
m_Name: Ingredient
m_TagString: Untagged
Expand All @@ -31,8 +32,8 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8321201880322001125}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -11.03, y: 1.42, z: 7.558644}
m_LocalScale: {x: 0.75, y: 0.75, z: 0.75}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.5, y: 0.5, z: 0.5}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 5073984626218265924}
Expand Down Expand Up @@ -156,6 +157,23 @@ MonoBehaviour:
m_BlueMaterial: {fileID: 2100000, guid: b423dced7a4ac4f40a119b84a23cfc9b, type: 2}
m_RedMaterial: {fileID: 2100000, guid: d1a9058ddc5c2461298f65541af6fcd9, type: 2}
m_ColorMesh: {fileID: 6206319821543937579}
--- !u!1818360608 &8102146958862450613
PositionConstraint:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8321201880322001125}
m_Enabled: 1
m_Weight: 1
m_TranslationAtRest: {x: 0, y: 0, z: 0}
m_TranslationOffset: {x: 0, y: 0, z: 0}
m_AffectTranslationX: 1
m_AffectTranslationY: 1
m_AffectTranslationZ: 1
m_IsContraintActive: 0
m_IsLocked: 0
m_Sources: []
--- !u!1001 &2596981318218469326
PrefabInstance:
m_ObjectHideFlags: 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,36 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &6707086203565642132
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7999395044045864920}
m_Layer: 0
m_Name: IngredientSocket
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &7999395044045864920
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6707086203565642132}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.009, y: 0.307, z: 0.599}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 7428674385873156833}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &7567938585585123398
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -201,6 +232,7 @@ MonoBehaviour:
isObjectPickedUp:
m_InternalValue: 0
m_LocalHeldPosition: {x: 0, y: 2.85, z: 0}
m_IngredientSocketTransform: {fileID: 7999395044045864920}
--- !u!114 &5667156634780145037
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -313,3 +345,8 @@ Animator:
m_CorrespondingSourceObject: {fileID: 6982812146204527121, guid: 64dce48905ffd9b4293e595fa6941544, type: 3}
m_PrefabInstance: {fileID: 3616664937583670245}
m_PrefabAsset: {fileID: 0}
--- !u!4 &7428674385873156833 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 6135884457200830724, guid: 64dce48905ffd9b4293e595fa6941544, type: 3}
m_PrefabInstance: {fileID: 3616664937583670245}
m_PrefabAsset: {fileID: 0}
38 changes: 34 additions & 4 deletions Basic/ClientDriven/Assets/Prefabs/Stove.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 460129599546355757}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: 0}
m_LocalPosition: {x: 0, y: 0.6, z: 0}
m_LocalScale: {x: 0.799936, y: 0.79490435, z: 0.799936}
m_ConstrainProportionsScale: 0
m_Children: []
Expand All @@ -125,7 +125,8 @@ GameObject:
- component: {fileID: 6565999940192035836}
- component: {fileID: 5765646857848886134}
- component: {fileID: 6747444258012977798}
m_Layer: 0
- component: {fileID: 4896843153810925154}
m_Layer: 7
m_Name: WhiteOutside
m_TagString: Untagged
m_Icon: {fileID: 0}
Expand Down Expand Up @@ -197,6 +198,20 @@ MeshRenderer:
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!64 &4896843153810925154
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3136404555388527449}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 4
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: -5076798556035486163, guid: f6bf731373f0fc94e88c51cdddb568ec, type: 3}
--- !u!1 &4898400489069481270
GameObject:
m_ObjectHideFlags: 0
Expand All @@ -208,7 +223,8 @@ GameObject:
- component: {fileID: 1387113040238020593}
- component: {fileID: 7869131191826614797}
- component: {fileID: 8073109338512125780}
m_Layer: 0
- component: {fileID: 6629855978167643442}
m_Layer: 7
m_Name: Clear
m_TagString: Untagged
m_Icon: {fileID: 0}
Expand Down Expand Up @@ -280,6 +296,20 @@ MeshRenderer:
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!64 &6629855978167643442
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4898400489069481270}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 4
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: -5076798556035486163, guid: f6bf731373f0fc94e88c51cdddb568ec, type: 3}
--- !u!1 &5728885798115879677
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -427,7 +457,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: cc801949a9a7a43eda0b39744dd74696, type: 3}
m_Name:
m_EditorClassIdentifier:
CurrentIngredientType:
currentIngredientType:
m_InternalValue: 0
m_CookingTime: 1
m_IngredientCookingLocation: {fileID: 517486088071705859}
Expand Down
8 changes: 8 additions & 0 deletions Basic/ClientDriven/Assets/Scripts/ClientPlayerMove.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ void OnPickUp()
if (m_ServerPlayerMove.isObjectPickedUp.Value)
{
m_ServerPlayerMove.DropObjectServerRpc();
m_ThirdPersonController.Holding = false;
}
else
{
Expand All @@ -95,6 +96,7 @@ void OnPickUp()
// will be a delay between the button press and the reparenting.
// This delay could be hidden with some animations/sounds/VFX that would be triggered here.
m_ServerPlayerMove.PickupObjectServerRpc(netObj);
m_ThirdPersonController.Holding = true;
}
}
}
Expand All @@ -108,4 +110,10 @@ public void SetSpawnClientRpc(Vector3 position, ClientRpcParams clientRpcParams
m_CharacterController.enabled = true;
gameObject.SetActive(true);
}

[ClientRpc]
public void DropIngredientClientRpc(ClientRpcParams clientRpcParams = default)
{
m_ThirdPersonController.Holding = false;
}
}
2 changes: 2 additions & 0 deletions Basic/ClientDriven/Assets/Scripts/Dropzone.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using StarterAssets;
using UnityEngine;

public class Dropzone : ServerObjectWithIngredientType
Expand Down Expand Up @@ -33,5 +34,6 @@ void OnTriggerEnter(Collider other)

m_ScoreTracker.Score += 1;
ingredient.NetworkObject.Despawn(destroy: true);
other.GetComponentInParent<ClientPlayerMove>().DropIngredientClientRpc();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ void FixedUpdate()
foreach (var spawnPoint in m_SpawnPoints)
{
var newIngredientObject = Instantiate(m_IngredientPrefab, spawnPoint.transform.position, spawnPoint.transform.rotation);
newIngredientObject.transform.position = spawnPoint.transform.position;
newIngredientObject.transform.position = spawnPoint.transform.position +
new Vector3(UnityEngine.Random.Range(-0.25f, 0.25f), 0, UnityEngine.Random.Range(-0.25f, 0.25f));
var ingredient = newIngredientObject.GetComponent<ServerIngredient>();
ingredient.NetworkObject.Spawn();
ingredient.currentIngredientType.Value = (IngredientType)m_RandomGenerator.Next((int)IngredientType.MAX);
Expand Down
22 changes: 20 additions & 2 deletions Basic/ClientDriven/Assets/Scripts/ServerPlayerMove.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using System;
using StarterAssets;
using Unity.Netcode;
using Unity.Netcode.Components;
using UnityEngine;
using UnityEngine.Animations;

/// <summary>
/// Server side script to do some movements that can only be done server side with Netcode. In charge of spawning (which happens server side in Netcode)
Expand All @@ -18,7 +20,7 @@ public class ServerPlayerMove : NetworkBehaviour
NetworkObject m_PickedUpObject;

[SerializeField]
Vector3 m_LocalHeldPosition;
Transform m_IngredientSocketTransform;

// DOC START HERE
public override void OnNetworkSpawn()
Expand Down Expand Up @@ -55,15 +57,22 @@ public void PickupObjectServerRpc(ulong objToPickupID)
pickUpObjectRigidbody.isKinematic = true;
pickUpObjectRigidbody.interpolation = RigidbodyInterpolation.None;
objectToPickup.GetComponent<NetworkTransform>().InLocalSpace = true;
objectToPickup.transform.localPosition = m_LocalHeldPosition;
objectToPickup.GetComponent<ServerIngredient>().ingredientDespawned += IngredientDespawned;
isObjectPickedUp.Value = true;
m_PickedUpObject = objectToPickup;
var positionConstraint = objectToPickup.GetComponent<PositionConstraint>();
positionConstraint.AddSource(new ConstraintSource()
{
sourceTransform = m_IngredientSocketTransform,
weight = 1
});
positionConstraint.constraintActive = true;
}
}

void IngredientDespawned()
{
DropIngredient(m_PickedUpObject.gameObject);
m_PickedUpObject = null;
isObjectPickedUp.Value = false;
}
Expand All @@ -79,10 +88,19 @@ public void DropObjectServerRpc()
pickedUpObjectRigidbody.isKinematic = false;
pickedUpObjectRigidbody.interpolation = RigidbodyInterpolation.Interpolate;
m_PickedUpObject.GetComponent<NetworkTransform>().InLocalSpace = false;
DropIngredient(m_PickedUpObject.gameObject);
m_PickedUpObject = null;
}

isObjectPickedUp.Value = false;
}

void DropIngredient(GameObject ingredientToDrop)
{
var positionConstraint = ingredientToDrop.GetComponent<PositionConstraint>();
positionConstraint.RemoveSource(0);
positionConstraint.constraintActive = false;
GetComponent<ThirdPersonController>().Holding = false;
}
// DOC END HERE
}
Binary file not shown.
Loading