Skip to content
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

[WIP] Animation system #1440

Open
wants to merge 160 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
160 commits
Select commit Hold shift + click to select a range
0ccd2ce
Creating avatar and adding animations
Dennis-Nesterenko Feb 15, 2024
806bf60
Adding breathing anim
Dennis-Nesterenko Feb 15, 2024
4626279
Adding throw anim
Dennis-Nesterenko Feb 15, 2024
f1acd65
import animations
stilnat Feb 17, 2024
1071699
rename anims
stilnat Feb 17, 2024
3bc1fd4
create new human prefab and controller
stilnat Feb 17, 2024
2de0157
set loop and animation names
stilnat Feb 17, 2024
8c8f6a6
create mask and animation scene
stilnat Feb 17, 2024
25cd061
rename anims
stilnat Feb 17, 2024
b23e4bf
update animator
stilnat Feb 17, 2024
6a2503b
crawl and sit
stilnat Feb 17, 2024
b180931
bake into pose
stilnat Feb 18, 2024
871d37c
Add stuff to animation test scene
stilnat Feb 18, 2024
a84e6f9
add animation rigging package
stilnat Feb 18, 2024
d826b4f
Ik punch tests
stilnat Feb 18, 2024
df6e105
ik punching go
stilnat Feb 18, 2024
ff29fb9
head tracking
stilnat Feb 18, 2024
56d8e3f
Adding animations
Dennis-Nesterenko Feb 19, 2024
02ad1b5
Merge branch 'Animations' of https://github.com/Dennis-Nesterenko/SS3…
Dennis-Nesterenko Feb 19, 2024
d2bb999
add leg masks
stilnat Feb 20, 2024
b1263e6
add bunch of animations
stilnat Feb 20, 2024
6f2332e
add some rotation and ik tweaking
stilnat Feb 20, 2024
4b7ac5e
quidditch
stilnat Feb 24, 2024
4ad7e7d
add test motion for target
stilnat Feb 24, 2024
bfdab57
rename and add pickup high
stilnat Feb 24, 2024
fbf2374
Merge pull request #22 from Dennis-Nesterenko/Animations
stilnat Feb 24, 2024
1c21a64
bunch of renaming
stilnat Feb 24, 2024
ab48ad9
some exit time changes
stilnat Feb 25, 2024
6af7234
add m4 gun
stilnat Feb 27, 2024
7cd6305
update .metas
stilnat Feb 27, 2024
7424138
add dummy movement
stilnat Feb 27, 2024
ca446f7
remove pickuplow
stilnat Feb 27, 2024
d0a0f82
rename M4 prefab
stilnat Feb 27, 2024
09c6735
add dummy item and dummy pick up
stilnat Feb 27, 2024
509cf12
trigger pick up and some simplification
stilnat Feb 27, 2024
6d809d7
add hands logic and throw stuff
stilnat Feb 28, 2024
fad236c
animation test scene update
stilnat Feb 28, 2024
d86b239
improve pickup
stilnat Feb 28, 2024
6c2148d
update pick up
stilnat Feb 29, 2024
93a8e94
some progress
stilnat Mar 1, 2024
3429253
add inspector gadgets
stilnat Mar 1, 2024
c3ee789
allow proper right and left hold
stilnat Mar 1, 2024
cde831f
add better support for two hands hold
stilnat Mar 2, 2024
edd6bce
attempt one
stilnat Mar 3, 2024
fb0e44e
fix stuff and improve shoulder position
stilnat Mar 3, 2024
9763ce4
Merge pull request #23 from stilnat/animation_simplify
stilnat Mar 3, 2024
c8fb9d1
fix offset bug
stilnat Mar 3, 2024
c1f0101
partial work change pose when throw
stilnat Mar 3, 2024
1ceb74e
fix switch from single to double hand
stilnat Mar 4, 2024
06e54fd
make switch one hand two hand work
stilnat Mar 4, 2024
ebc0856
fix bug with item doing item hold update when not needed
stilnat Mar 4, 2024
053dca0
fix little jump in animation
stilnat Mar 5, 2024
a18916b
remove smb
stilnat Mar 7, 2024
55c6eb6
orient player toward target
stilnat Mar 7, 2024
a0060b9
add hand script and simplify
stilnat Mar 8, 2024
73590fb
simplify stuff
stilnat Mar 8, 2024
804572d
add intent stuff
stilnat Mar 8, 2024
7d1d595
param gun harm intent
stilnat Mar 8, 2024
b60bb57
offset on intent
stilnat Mar 8, 2024
43c76a1
buggy refactor
stilnat Mar 9, 2024
2e4c2ea
buggy refactor part 3
stilnat Mar 9, 2024
9ec44ab
refactor working (almost)
stilnat Mar 9, 2024
5222409
cleanup
stilnat Mar 9, 2024
24b5dde
addIntentSwitch
stilnat Mar 9, 2024
86656a4
fix some bugs
stilnat Mar 9, 2024
0dab0ee
more cleanup and refactor
stilnat Mar 9, 2024
13972aa
refactor and rename
stilnat Mar 9, 2024
30631cf
fix weird stuff
stilnat Mar 9, 2024
eea7a3c
add many dummy items and stuff
stilnat Mar 10, 2024
592ef64
factor code
stilnat Mar 10, 2024
5aafac8
use hand parameter
stilnat Mar 10, 2024
36096ca
first attempt
stilnat Mar 11, 2024
87e1ce8
place stuff !
stilnat Mar 11, 2024
383c61e
fix second hand place
stilnat Mar 12, 2024
1980e06
clean up
stilnat Mar 12, 2024
b0a38c4
cleanup and add looking at place and pickup
stilnat Mar 12, 2024
673d3dd
fix hold.r instread of hand.r in pickup constraint rig
stilnat Mar 14, 2024
044791f
add doc and try fixing pickup
stilnat Mar 14, 2024
3cb8796
place and pickup with two hands
stilnat Mar 14, 2024
389e73c
add smooth position transitions
stilnat Mar 14, 2024
84bed13
separate pickup and place
stilnat Mar 14, 2024
1405e18
Add ability to hold small items
stilnat Mar 15, 2024
97397af
starting messing with interact
stilnat Mar 17, 2024
6ff1640
correctly put item interaction on target
stilnat Mar 17, 2024
ce517c1
allow rotating while interacting
stilnat Mar 17, 2024
64ec381
add looking at
stilnat Mar 17, 2024
58c9e10
pickup and position constraint weight change
stilnat Mar 17, 2024
d49135f
update wrench
stilnat Mar 17, 2024
10eca95
update interactive welder
stilnat Mar 17, 2024
aa181ac
fire bullets
stilnat Mar 17, 2024
3c33d78
add weapon aiming and firing
stilnat Mar 18, 2024
b83bd9a
fix constant aim
stilnat Mar 18, 2024
eb867ee
fix gun shoulder aiming position
stilnat Mar 18, 2024
a730dea
clean up aim script and update aim ability
stilnat Mar 20, 2024
6e8b345
interact only with tools
stilnat Mar 20, 2024
adf7cce
fix initial weight body aim and left shoulder aiming
stilnat Mar 21, 2024
cd425ed
small item update
stilnat Mar 21, 2024
8eab4e7
sitting
stilnat Mar 21, 2024
1462caa
Add crouch walking animation and crouch when items are low
stilnat Mar 22, 2024
5422967
place crouch
stilnat Mar 22, 2024
3d3e099
throwing first part
stilnat Mar 24, 2024
43bfa1c
throwing part 2
stilnat Mar 25, 2024
8ee571a
fix throwing rotation
stilnat Mar 25, 2024
2a33925
some fixes
stilnat Mar 26, 2024
df4b0e6
fix rotation when sitting and fire error
stilnat Mar 26, 2024
af15d8b
reallow interaction
stilnat Mar 27, 2024
4c69438
cleanup
stilnat Mar 27, 2024
b3fcaa4
fix aiming with throw
stilnat Mar 27, 2024
6d9c28c
fix aiming with throw
stilnat Mar 27, 2024
79a40ea
make throw a toggle
stilnat Mar 27, 2024
b43503f
fix position constraint update when rotating
stilnat Mar 27, 2024
affe4b7
update hold position on m4
stilnat Mar 27, 2024
f5166c5
add namespace and assembly def
stilnat Apr 1, 2024
9b358c4
add playmodecomponentsaver
stilnat Apr 1, 2024
ffda02b
fix gun not firing
stilnat Apr 1, 2024
4d0bc50
add pulse rifle
stilnat Apr 1, 2024
d894431
add briefcases lockbox
stilnat Apr 1, 2024
6c1e202
very simple movement controller
stilnat Apr 1, 2024
4b3da25
add physic movement controll, unbolted girder
stilnat Apr 1, 2024
9dd2c65
revert human prefab
stilnat Apr 1, 2024
9622e03
fix human
stilnat Apr 1, 2024
6f72c82
remove broken prefab
stilnat Apr 2, 2024
2276c20
add ragdolling
stilnat Apr 2, 2024
e762843
add ragdoll human
stilnat Apr 2, 2024
78e7ab3
grabbing update
stilnat Apr 7, 2024
89fdd98
remove inspector gadget
stilnat Apr 7, 2024
03c0aac
removing inspector gadget
stilnat Apr 7, 2024
e638070
change movement when aiming
stilnat Apr 7, 2024
99e38f1
stop aiming after throw
stilnat Apr 7, 2024
edeb70c
add max force
stilnat Apr 7, 2024
08c1477
fix throw with two hands
stilnat Apr 7, 2024
7386652
fix sitting
stilnat Apr 7, 2024
140118a
limit shooting angle
stilnat Apr 7, 2024
888e6b2
some cleanup
stilnat Apr 7, 2024
ab1ae1f
fix interaction points
stilnat Apr 7, 2024
cb491b0
some cleaning up
stilnat Apr 7, 2024
6287fe3
clean up interact
stilnat Apr 8, 2024
e53084c
look at item when interacting
stilnat Apr 8, 2024
7c2b0d9
clean up and crouch when interacting low
stilnat Apr 8, 2024
2b73e6e
mini clean up
stilnat Apr 8, 2024
8de49ed
add dragging movement
stilnat Apr 9, 2024
2f17942
swittch throw intent
stilnat Apr 9, 2024
9198676
throw differently depending on intent
stilnat Apr 9, 2024
616fad6
fix gun aim and clean up
stilnat Apr 10, 2024
ae92472
move target locker in human prefab
stilnat Apr 11, 2024
497a569
establish back aim movement
stilnat Apr 11, 2024
594e88a
remove temp anims
stilnat Apr 12, 2024
9d5c245
add new anims
stilnat Apr 12, 2024
4cbc7ed
add crouch to animator
stilnat Apr 12, 2024
09e9aa3
add some masks
stilnat Apr 12, 2024
9312856
add layer to controller
stilnat Apr 12, 2024
365b0e2
character armature root motion
stilnat Apr 12, 2024
41fe6d8
aiming faster
stilnat Apr 25, 2024
3330b7f
fix hand rotation on grab and slightly smoother
stilnat Apr 26, 2024
8149f46
do not fly
stilnat Apr 26, 2024
3b32cf6
smooth grab
stilnat Apr 26, 2024
e0fd4ba
more precise grabbing
stilnat Apr 26, 2024
421265a
Adding another pose
Dennis-Nesterenko Apr 28, 2024
d5fb07f
Update HumanStancesDef.fbx
Dennis-Nesterenko Apr 28, 2024
af33bbb
Idk why my changes didnt work until now
Dennis-Nesterenko Apr 28, 2024
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
Binary file added Assets/Art/Animations/GetUpFromBack.fbx
Binary file not shown.
895 changes: 895 additions & 0 deletions Assets/Art/Animations/GetUpFromBack.fbx.meta

Large diffs are not rendered by default.

Binary file added Assets/Art/Animations/GetUpFromFront.fbx
Binary file not shown.
895 changes: 895 additions & 0 deletions Assets/Art/Animations/GetUpFromFront.fbx.meta

Large diffs are not rendered by default.

Binary file added Assets/Art/Animations/HumanActionSetDEF.fbx
Binary file not shown.
895 changes: 895 additions & 0 deletions Assets/Art/Animations/HumanActionSetDEF.fbx.meta

Large diffs are not rendered by default.

Binary file added Assets/Art/Animations/HumanBreath.fbx
Binary file not shown.
898 changes: 898 additions & 0 deletions Assets/Art/Animations/HumanBreath.fbx.meta

Large diffs are not rendered by default.

Binary file added Assets/Art/Animations/HumanCrawlProneSetDef.fbx
Binary file not shown.
897 changes: 897 additions & 0 deletions Assets/Art/Animations/HumanCrawlProneSetDef.fbx.meta

Large diffs are not rendered by default.

Binary file added Assets/Art/Animations/HumanCrouchSetDef.fbx
Binary file not shown.
1,023 changes: 1,023 additions & 0 deletions Assets/Art/Animations/HumanCrouchSetDef.fbx.meta

Large diffs are not rendered by default.

Binary file added Assets/Art/Animations/HumanFingerPosesDef.fbx
Binary file not shown.
884 changes: 884 additions & 0 deletions Assets/Art/Animations/HumanFingerPosesDef.fbx.meta

Large diffs are not rendered by default.

16,157 changes: 16,157 additions & 0 deletions Assets/Art/Animations/HumanInteract.fbx

Large diffs are not rendered by default.

905 changes: 905 additions & 0 deletions Assets/Art/Animations/HumanInteract.fbx.meta

Large diffs are not rendered by default.

16,157 changes: 16,157 additions & 0 deletions Assets/Art/Animations/HumanPunch.fbx

Large diffs are not rendered by default.

910 changes: 910 additions & 0 deletions Assets/Art/Animations/HumanPunch.fbx.meta

Large diffs are not rendered by default.

Binary file added Assets/Art/Animations/HumanRun.fbx
Binary file not shown.
899 changes: 899 additions & 0 deletions Assets/Art/Animations/HumanRun.fbx.meta

Large diffs are not rendered by default.

Binary file added Assets/Art/Animations/HumanRunningSetDef.fbx
Binary file not shown.
875 changes: 875 additions & 0 deletions Assets/Art/Animations/HumanRunningSetDef.fbx.meta

Large diffs are not rendered by default.

Binary file added Assets/Art/Animations/HumanStancesDef.fbx
Binary file not shown.
866 changes: 866 additions & 0 deletions Assets/Art/Animations/HumanStancesDef.fbx.meta

Large diffs are not rendered by default.

16,155 changes: 16,155 additions & 0 deletions Assets/Art/Animations/HumanThrow.fbx

Large diffs are not rendered by default.

905 changes: 905 additions & 0 deletions Assets/Art/Animations/HumanThrow.fbx.meta

Large diffs are not rendered by default.

Binary file added Assets/Art/Animations/HumanWalk.fbx
Binary file not shown.
898 changes: 898 additions & 0 deletions Assets/Art/Animations/HumanWalk.fbx.meta

Large diffs are not rendered by default.

Binary file added Assets/Art/Animations/HumanWalkingSetDef.fbx
Binary file not shown.
897 changes: 897 additions & 0 deletions Assets/Art/Animations/HumanWalkingSetDef.fbx.meta

Large diffs are not rendered by default.

Binary file added Assets/Art/Animations/InjuredIdle.fbx
Binary file not shown.
895 changes: 895 additions & 0 deletions Assets/Art/Animations/InjuredIdle.fbx.meta

Large diffs are not rendered by default.

Binary file added Assets/Art/Animations/InjuredWalk.fbx
Binary file not shown.
895 changes: 895 additions & 0 deletions Assets/Art/Animations/InjuredWalk.fbx.meta

Large diffs are not rendered by default.

Binary file added Assets/Art/Animations/StandToSit.fbx
Binary file not shown.
895 changes: 895 additions & 0 deletions Assets/Art/Animations/StandToSit.fbx.meta

Large diffs are not rendered by default.

Binary file added Assets/Art/Animations/StomachHit.fbx
Binary file not shown.
895 changes: 895 additions & 0 deletions Assets/Art/Animations/StomachHit.fbx.meta

Large diffs are not rendered by default.

Binary file added Assets/Art/Animations/Strafe.fbx
Binary file not shown.
895 changes: 895 additions & 0 deletions Assets/Art/Animations/Strafe.fbx.meta

Large diffs are not rendered by default.

Binary file added Assets/Art/Animations/TwistDance.fbx
Binary file not shown.
895 changes: 895 additions & 0 deletions Assets/Art/Animations/TwistDance.fbx.meta

Large diffs are not rendered by default.

782 changes: 771 additions & 11 deletions Assets/Art/Models/Entities/Humanoids/Human/Human.fbx.meta

Large diffs are not rendered by default.

3,368 changes: 3,368 additions & 0 deletions Assets/Content/Scenes/AnimationTests.unity

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions Assets/Content/Scenes/AnimationTests.unity.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assets/Content/WorldObjects/DummyAnimationTestsObjects.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using UnityEngine;

public class CircleSinusoidalMotion : MonoBehaviour
{
public float radius = 5f; // Radius of the circular motion
public float speed = 1f; // Speed of the motion
public float minHeight = 1f; // Minimum height of the sinusoidal motion
public float maxHeight = 3f; // Maximum height of the sinusoidal motion
public float waveFrequency = 4f; // Frequency of the sinusoidal motion

private float angle = 0f;

void Update()
{
// Increment angle based on speed
angle += speed * Time.deltaTime;

// Calculate position using sine and cosine functions
float x = Mathf.Cos(angle) * radius;
float y = Mathf.Lerp(minHeight, maxHeight, Mathf.Sin(angle * waveFrequency) * 0.5f + 0.5f); // Dynamically adjust height
float z = Mathf.Sin(angle) * radius;

// Update the position of the GameObject
transform.position = new Vector3(x, y, z);
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public static class CoroutineHelper
{


public static IEnumerator ModifyValueOverTime(Action<float> value,
float startValue, float endValue, float time)
{
float elapsedTime = 0f;

while (elapsedTime < time)
{
value(startValue + (endValue-startValue)*(elapsedTime/time));
elapsedTime += Time.deltaTime;
yield return null;
}

// Ensure the value reaches the target value exactly
value(endValue);
}

public static IEnumerator ModifyVector3OverTime(Action<Vector3> value,
Vector3 startValue, Vector3 endValue, float time)
{
float elapsedTime = 0f;

while (elapsedTime < time)
{
value(startValue + (endValue-startValue)*(elapsedTime/time));
elapsedTime += Time.deltaTime;
yield return null;
}

// Ensure the value reaches the target value exactly
value(endValue);
}

public static IEnumerator ModifyQuaternionOverTime(Action<Quaternion> value,
Quaternion startValue, Quaternion endValue, float time)
{
float elapsedTime = 0f;

while (elapsedTime < time)
{
value(Quaternion.Slerp(startValue, endValue, elapsedTime/time));
elapsedTime += Time.deltaTime;
yield return null;
}

// Ensure the value reaches the target value exactly
value(endValue);
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

119 changes: 119 additions & 0 deletions Assets/Content/WorldObjects/DummyAnimationTestsObjects/DummyAim.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
using Coimbra;
using System;
using UnityEngine;
using UnityEngine.Animations.Rigging;

namespace DummyStuff
{
public sealed class DummyAim : MonoBehaviour
{

public Transform aimTarget;

public DummyHands hands;

public IntentController intents;

public HoldController holdController;

public Rig bodyAimRig;

public float rotationSpeed = 5f;

public bool canAim;

public bool isAiming;

public event EventHandler<bool> OnAim;

[SerializeField]
private DummyMovement movementController;


private void Update()
{
UpdateAimAbility(hands.SelectedHand);

if (canAim && Input.GetMouseButton(1))
{
UpdateAimTargetPosition();

if (!isAiming)
{
Aim(hands.SelectedHand, hands.SelectedHand.Item.GameObject.GetComponent<DummyGun>());
isAiming = true;
}

if (GetComponent<DummyPositionController>().Position != PositionType.Sitting)
{
movementController.RotatePlayerTowardTarget();
}
}
else if (isAiming && (!canAim || !Input.GetMouseButton(1)))
{
StopAiming(hands.SelectedHand);
}



if (Input.GetKey(KeyCode.E) && hands.SelectedHand.Full
&& isAiming && hands.SelectedHand.Item.GameObject.TryGetComponent(out DummyGun gun))
{
gun.GetComponent<DummyFire>().Fire();
}

}

private void Aim(DummyHand hand, DummyGun gun)
{
bodyAimRig.weight = 0.3f;
gun.transform.parent = hands.SelectedHand.shoulderWeaponPivot;

// position correctly the gun on the shoulder, assuming the rifle butt transform is defined correctly
gun.transform.localPosition = -gun.rifleButt.localPosition;
gun.transform.localRotation = Quaternion.identity;
OnAim?.Invoke(this, true);
}

private void StopAiming(DummyHand hand)
{
isAiming = false;
bodyAimRig.weight = 0f;

if (!hand.Full)
return;

hand.Item.GameObject.transform.parent = hand.itemPositionTargetLocker;
holdController.UpdateItemPositionConstraintAndRotation(hand, hand.Item,
true, 0.25f, false);
hand.Item.GameObject.transform.localPosition = Vector3.zero;
hand.Item.GameObject.transform.localRotation = Quaternion.identity;
OnAim?.Invoke(this, false);
}

private void UpdateAimAbility(DummyHand selectedHand)
{
if (intents.Intent == Intent.Harm && selectedHand.Full
&& selectedHand.Item.GameObject.HasComponent<DummyGun>())
{
canAim = true;
}
else
{
canAim = false;
}
}

private void UpdateAimTargetPosition()
{
// Cast a ray from the mouse position into the scene
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

// Check if the ray hits any collider
if (Physics.Raycast(ray, out RaycastHit hit))
{
aimTarget.position = hit.point;
}
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading