Added particle and bug fixes #437

Merged
glencelow merged 7 commits from PlayerController into main 2023-03-24 16:09:43 +08:00
5 changed files with 115 additions and 37 deletions
Showing only changes of commit 179740f4bf - Show all commits

View File

@ -2419,7 +2419,7 @@
Components: Components:
Transform Component: Transform Component:
Translate: {x: 0, y: 0, z: 0} Translate: {x: 0, y: 0, z: 0}
Rotate: {x: -1.48352981, y: 1.39999998, z: -3.50001717} Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1} Scale: {x: 1, y: 1, z: 1}
IsActive: true IsActive: true
Renderable Component: Renderable Component:
@ -7207,11 +7207,11 @@
- Is Trigger: true - Is Trigger: true
Collision Tag: 0 Collision Tag: 0
Type: Box Type: Box
Half Extents: {x: 1.79999995, y: 1, z: 1} Half Extents: {x: 4, y: 1, z: 4}
Friction: 0.400000006 Friction: 0.400000006
Bounciness: 0 Bounciness: 0
Density: 1 Density: 1
Position Offset: {x: 0, y: 0, z: 0} Position Offset: {x: -1, y: -1.5, z: 1.5}
Rotation Offset: {x: 0, y: 0, z: 0} Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true IsActive: true
Scripts: Scripts:
@ -7270,11 +7270,11 @@
- Is Trigger: true - Is Trigger: true
Collision Tag: 0 Collision Tag: 0
Type: Box Type: Box
Half Extents: {x: 1, y: 1, z: 0.200000003} Half Extents: {x: 4, y: 1, z: 4}
Friction: 0.400000006 Friction: 0.400000006
Bounciness: 0 Bounciness: 0
Density: 1 Density: 1
Position Offset: {x: 0, y: 0, z: 0} Position Offset: {x: 0, y: -1.5, z: -2}
Rotation Offset: {x: 0, y: 0, z: 0} Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true IsActive: true
Scripts: Scripts:
@ -7333,11 +7333,11 @@
- Is Trigger: true - Is Trigger: true
Collision Tag: 0 Collision Tag: 0
Type: Box Type: Box
Half Extents: {x: 1.79999995, y: 1, z: 1} Half Extents: {x: 4, y: 1, z: 4}
Friction: 0.400000006 Friction: 0.400000006
Bounciness: 0 Bounciness: 0
Density: 1 Density: 1
Position Offset: {x: 0, y: 0, z: 0} Position Offset: {x: 1, y: -1.5, z: 1.5}
Rotation Offset: {x: 0, y: 0, z: 0} Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true IsActive: true
Scripts: Scripts:
@ -7396,11 +7396,11 @@
- Is Trigger: true - Is Trigger: true
Collision Tag: 0 Collision Tag: 0
Type: Box Type: Box
Half Extents: {x: 1, y: 1, z: 1.79999995} Half Extents: {x: 4, y: 1, z: 4}
Friction: 0.400000006 Friction: 0.400000006
Bounciness: 0 Bounciness: 0
Density: 1 Density: 1
Position Offset: {x: 0, y: 0, z: 0} Position Offset: {x: 1.5, y: -1.5, z: -1}
Rotation Offset: {x: 0, y: 0, z: 0} Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true IsActive: true
Scripts: Scripts:
@ -7459,11 +7459,11 @@
- Is Trigger: true - Is Trigger: true
Collision Tag: 0 Collision Tag: 0
Type: Box Type: Box
Half Extents: {x: 1, y: 1, z: 1.79999995} Half Extents: {x: 4, y: 1, z: 4}
Friction: 0.400000006 Friction: 0.400000006
Bounciness: 0 Bounciness: 0
Density: 1 Density: 1
Position Offset: {x: 0, y: 0, z: 0} Position Offset: {x: 1.5, y: -1.5, z: 1}
Rotation Offset: {x: 0, y: 0, z: 0} Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true IsActive: true
Scripts: Scripts:
@ -7501,7 +7501,7 @@
- EID: 65775 - EID: 65775
Name: Player Name: Player
IsActive: true IsActive: true
NumberOfChildren: 5 NumberOfChildren: 6
Components: Components:
Transform Component: Transform Component:
Translate: {x: -8, y: 0.899999976, z: -4} Translate: {x: -8, y: 0.899999976, z: -4}
@ -7577,6 +7577,8 @@
lerpPickUpDuration: 0.75 lerpPickUpDuration: 0.75
tweenAimDuration: 0.300000012 tweenAimDuration: 0.300000012
aimingFOV: 15 aimingFOV: 15
trajMaxSteps: 50
trajTimeSteps: 0.0160000008
- Type: StateMachine - Type: StateMachine
Enabled: true Enabled: true
currentStateName: Idle State currentStateName: Idle State
@ -7702,6 +7704,25 @@
AnimationController: 0 AnimationController: 0
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
- EID: 522
Name: Tracjectory
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 0.200000003, y: 0.200000003, z: 0.200000003}
IsActive: true
Trajectory Renderer Component:
Mesh: 134305891
Start Color: {x: 0.625550628, y: 1, z: 0}
Start Alpha: 1
End Color: {x: 1, y: 0.898678422, z: 0}
End Alpha: 1
"Color Eval Rate ": 0.5
IsActive: true
Scripts: ~
- EID: 65732 - EID: 65732
Name: RespawnPoint Name: RespawnPoint
IsActive: true IsActive: true

View File

@ -2767,11 +2767,11 @@
- Is Trigger: true - Is Trigger: true
Collision Tag: 0 Collision Tag: 0
Type: Box Type: Box
Half Extents: {x: 1.79999995, y: 1, z: 1} Half Extents: {x: 5, y: 1, z: 4}
Friction: 0.400000006 Friction: 0.400000006
Bounciness: 0 Bounciness: 0
Density: 1 Density: 1
Position Offset: {x: 0, y: 0, z: 0} Position Offset: {x: 0, y: -1.5, z: 1.5}
Rotation Offset: {x: 0, y: 0, z: 0} Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true IsActive: true
Scripts: Scripts:
@ -2830,11 +2830,11 @@
- Is Trigger: true - Is Trigger: true
Collision Tag: 0 Collision Tag: 0
Type: Box Type: Box
Half Extents: {x: 1, y: 1, z: 0.200000003} Half Extents: {x: 4, y: 1, z: 4}
Friction: 0.400000006 Friction: 0.400000006
Bounciness: 0 Bounciness: 0
Density: 1 Density: 1
Position Offset: {x: 0, y: 0, z: 0} Position Offset: {x: 0, y: -1.5, z: -2}
Rotation Offset: {x: 0, y: 0, z: 0} Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true IsActive: true
Scripts: Scripts:
@ -2899,7 +2899,7 @@
- EID: 2 - EID: 2
Name: Player Name: Player
IsActive: true IsActive: true
NumberOfChildren: 5 NumberOfChildren: 6
Components: Components:
Transform Component: Transform Component:
Translate: {x: 2.35245037, y: 0.0613552481, z: 7.10571432} Translate: {x: 2.35245037, y: 0.0613552481, z: 7.10571432}
@ -2975,6 +2975,8 @@
lerpPickUpDuration: 0.75 lerpPickUpDuration: 0.75
tweenAimDuration: 0.300000012 tweenAimDuration: 0.300000012
aimingFOV: 15 aimingFOV: 15
trajMaxSteps: 50
trajTimeSteps: 0.0166999996
- Type: PlayerAnimations - Type: PlayerAnimations
Enabled: true Enabled: true
playerIdleClip: 227450439 playerIdleClip: 227450439
@ -3096,6 +3098,25 @@
AnimationController: 0 AnimationController: 0
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
- EID: 569
Name: Trajectory
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 2.35245013, y: -0.0613552481, z: 7.10571909}
Rotate: {x: 0, y: -3.14159274, z: 0}
Scale: {x: 0.200000033, y: 0.200000003, z: 0.200000033}
IsActive: true
Trajectory Renderer Component:
Mesh: 134305891
Start Color: {x: 0.627451003, y: 1, z: 0}
Start Alpha: 1
End Color: {x: 1, y: 0.898039222, z: 0}
End Alpha: 1
"Color Eval Rate ": 0.5
IsActive: true
Scripts: ~
- EID: 239 - EID: 239
Name: RespawnPoint Name: RespawnPoint
IsActive: true IsActive: true
@ -5461,7 +5482,7 @@
Components: Components:
Transform Component: Transform Component:
Translate: {x: 0, y: -300, z: 0} Translate: {x: 0, y: -300, z: 0}
Rotate: {x: -1.48352981, y: 0.5, z: 0.399993658} Rotate: {x: 0.5, y: 2.82014489, z: 0.5}
Scale: {x: 400, y: 100, z: 500} Scale: {x: 400, y: 100, z: 500}
IsActive: true IsActive: true
Renderable Component: Renderable Component:

View File

@ -8877,11 +8877,11 @@
- Is Trigger: true - Is Trigger: true
Collision Tag: 0 Collision Tag: 0
Type: Box Type: Box
Half Extents: {x: 1, y: 1, z: 1.79999995} Half Extents: {x: 5, y: 1, z: 5}
Friction: 0.400000006 Friction: 0.400000006
Bounciness: 0 Bounciness: 0
Density: 1 Density: 1
Position Offset: {x: 0, y: 0, z: 0} Position Offset: {x: -1.89999998, y: -1.5, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0} Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true IsActive: true
Scripts: Scripts:
@ -8940,11 +8940,11 @@
- Is Trigger: true - Is Trigger: true
Collision Tag: 0 Collision Tag: 0
Type: Box Type: Box
Half Extents: {x: 0.5, y: 1, z: 1} Half Extents: {x: 4, y: 1, z: 4}
Friction: 0.400000006 Friction: 0.400000006
Bounciness: 0 Bounciness: 0
Density: 1 Density: 1
Position Offset: {x: 0, y: 0, z: 0} Position Offset: {x: -1.89999998, y: -1.5, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0} Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true IsActive: true
Scripts: Scripts:
@ -9003,11 +9003,11 @@
- Is Trigger: true - Is Trigger: true
Collision Tag: 0 Collision Tag: 0
Type: Box Type: Box
Half Extents: {x: 1.79999995, y: 1, z: 1} Half Extents: {x: 4, y: 0.5, z: 4}
Friction: 0.400000006 Friction: 0.400000006
Bounciness: 0 Bounciness: 0
Density: 1 Density: 1
Position Offset: {x: 0, y: 0, z: 0} Position Offset: {x: 0, y: -1, z: -1.60000002}
Rotation Offset: {x: 0, y: 0, z: 0} Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true IsActive: true
Scripts: Scripts:
@ -11964,7 +11964,7 @@
- EID: 65775 - EID: 65775
Name: Player Name: Player
IsActive: true IsActive: true
NumberOfChildren: 5 NumberOfChildren: 6
Components: Components:
Transform Component: Transform Component:
Translate: {x: 5.5, y: 0.171148509, z: 10} Translate: {x: 5.5, y: 0.171148509, z: 10}
@ -12040,6 +12040,8 @@
lerpPickUpDuration: 0.75 lerpPickUpDuration: 0.75
tweenAimDuration: 0.300000012 tweenAimDuration: 0.300000012
aimingFOV: 15 aimingFOV: 15
trajMaxSteps: 50
trajTimeSteps: 0.0160000008
- Type: PlayerAnimations - Type: PlayerAnimations
Enabled: true Enabled: true
playerIdleClip: 227450439 playerIdleClip: 227450439
@ -12161,6 +12163,25 @@
AnimationController: 0 AnimationController: 0
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
- EID: 600
Name: Trajectory
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 2.35245013, y: -0.0613552481, z: 7.10571909}
Rotate: {x: 0, y: -3.14159274, z: 0}
Scale: {x: 0.200000033, y: 0.200000003, z: 0.200000033}
IsActive: true
Trajectory Renderer Component:
Mesh: 134305891
Start Color: {x: 0.627451003, y: 1, z: 0}
Start Alpha: 1
End Color: {x: 1, y: 0.898039222, z: 0}
End Alpha: 1
"Color Eval Rate ": 0.5
IsActive: true
Scripts: ~
- EID: 66065 - EID: 66065
Name: RespawnPoint Name: RespawnPoint
IsActive: true IsActive: true

View File

@ -50,6 +50,14 @@ public class PickAndThrow : Script
public float aimingFOV = 15.0f; public float aimingFOV = 15.0f;
private TrajectoryRenderable trajComp;
private Vector3 currThrowForce;
private float currentItemMass;
public uint trajMaxSteps = 50;
public float trajTimeSteps = 0.03f;
protected override void awake() protected override void awake()
{ {
pc = GetScript<PlayerController>(); pc = GetScript<PlayerController>();
@ -67,6 +75,10 @@ public class PickAndThrow : Script
AudioHandler.audioClipHandlers["SFXThrow"] = Audio.CreateAudioClip("event:/Raccoon/raccoon_throw"); AudioHandler.audioClipHandlers["SFXThrow"] = Audio.CreateAudioClip("event:/Raccoon/raccoon_throw");
timer = delayTimer; timer = delayTimer;
trajComp = GetComponentInChildren<TrajectoryRenderable>();
if(!trajComp)
Debug.LogError("TrajectoryRenderable MISSING");
} }
protected override void start() protected override void start()
@ -161,6 +173,19 @@ public class PickAndThrow : Script
PlayPickUpAnimation(); PlayPickUpAnimation();
} }
} }
if (pc.isAiming && itemScript)
{
if (itemScript.currCategory == ItemCategory.LIGHT)
currThrowForce = new Vector3(throwForce.x * lastXDir, throwForce.y + (throwForce.y * GetPitchRatioRange()), throwForce.z * lastZDir) * 0.2f;
else if (itemScript.currCategory == ItemCategory.MEDIUM)
currThrowForce = new Vector3(throwForce.x * lastXDir, throwForce.y + (throwForce.y * GetPitchRatioRange()), throwForce.z * lastZDir) * 0.75f;
else
currThrowForce = new Vector3(throwForce.x * lastXDir, throwForce.y + (throwForce.y * GetPitchRatioRange()), throwForce.z * lastZDir);
if (pc.holdItem && trajComp)
trajComp.SimulateTrajectory(item.EntityId, currentItemMass, currThrowForce, trajTimeSteps, trajMaxSteps);
}
} }
protected override void fixedUpdate() protected override void fixedUpdate()
@ -172,16 +197,7 @@ public class PickAndThrow : Script
if (throwItem && itemRidigBody && pc) if (throwItem && itemRidigBody && pc)
{ {
if (itemScript) itemRidigBody.AddForce(currThrowForce);
{
Vector3 vec = new Vector3(throwForce.x * lastXDir, throwForce.y + (throwForce.y * GetPitchRatioRange()), throwForce.z * lastZDir);
if (itemScript.currCategory == ItemCategory.LIGHT)
itemRidigBody.AddForce(vec * 0.2f);
if (itemScript.currCategory == ItemCategory.MEDIUM)
itemRidigBody.AddForce(vec * 0.75f);
if (itemScript.currCategory == ItemCategory.HEAVY)
itemRidigBody.AddForce(vec);
}
itemRidigBody.LinearVelocity += pc.rb.LinearVelocity; itemRidigBody.LinearVelocity += pc.rb.LinearVelocity;
throwItem = false; throwItem = false;
ResetItemObject(); ResetItemObject();
@ -207,6 +223,7 @@ public class PickAndThrow : Script
Debug.Log("Item rb EMPTY"); Debug.Log("Item rb EMPTY");
else else
{ {
currentItemMass = itemRidigBody.Mass;
itemRidigBody.IsGravityEnabled = false; itemRidigBody.IsGravityEnabled = false;
} }

View File

@ -115,8 +115,6 @@ namespace SHADE
comp.ResetSimulationInfo(); comp.ResetSimulationInfo();
std::cout << positions.size() << std::endl;
// If has positions, feed data to buffer. // If has positions, feed data to buffer.
if (!positions.empty()) if (!positions.empty())
{ {