160 likes | 172 Views
Explore raycasting techniques like Camera-to-World, NavMesh baking, & NavMesh.Agent setup, along with Animation timeline use. Learn about GameObject-to-GameObject raycasting, Enums for Player/Enemy States, applying damage mechanisms, and more.
E N D
Unity Game Development Raycasting, Animation timeline & Animator
Class overview • Class 3 Revision • Raycasting – Camera-to-World • NavMeshBaking & NavMesh Agent • Click Visualisation • Camera Movement • Importing 3D models • Animation timeline • Animation events • Animator • Raycasting – GameObject-to-GameObject • Enums– Player States • Advanced: Applying Damage
Revision • Parenting objects in Hierarchy • Canvas UI • Enums – Enemy States • NavMesh Baking • NavMesh Agent • Setting Enemy Patrols • Range & Radius Checking • Damage to Player • Damage to Zombies
Raycasting – Camera-to-World • Raycast= Shoot Laser from point A to point B, check for objects hit (= RayCastHit). • Raycast from Camera to Mouse Position in World Space.
NavMesh Baking & NavMesh Agent • Attach NavMeshAgent to Player • Setup Steering Settings • Window AI Navigation • Make objects Static in order to bake NavMesh
Click visualisation • Display Sphere where Player Clicked • Shrink Sphere Object over time
Camera Movement • Move Camera based on Mouse Position in Screen Space • Center Camera on Player when you press Spacebar
Importing 3D models • Download .FBX file • Import in Unity editor • Example websites: • https://www.turbosquid.com/Search/3D-Models/free • https://free3d.com/ • Unity Asset Store
Animation timeline • Window Animation Animation • Add Keyframes and change properties such as position, rotation, scale, …
Animation events • Right-Click Add Animation Event • Link AnimationEvent to Code Function
Animator • Setup Idle & SwordAnim States • Setup Parameters & Set Parameter from Code
Raycasting – GameObject-to-GameObject • Shoot Ray forwards from Player Position.
Enums – Player States • Idle • Moving • AttackMoving • If Player clicks on Enemy move Player towards Enemy. • Start Attacking when in Range.
Advanced: Applying Damage • Implement Health system • Reduce Enemy Health on Sword Impact
Q&A • Do you have any questions related to the topics mentioned?