FreshRSS

Normální zobrazení

Jsou dostupné nové články, klikněte pro obnovení stránky.
PředevčíremHlavní kanál
  • ✇Recent Questions - Game Development Stack Exchange
  • Player-Environment Interaction & Collision Handling in UnityNotLucifer
    Simply put, how would you go about designing environmental interactions? For example, upon pressing the interact button when near a chair, he can sit on it. (Also works with NPCs functioning with NavMeshAgent component.) For now, the interaction system works by raycasting towards players look direction and looking for Interactables and once an interactable is detected, the InputAction for Interact is able to perform its subscribed actions. So, now in my game, I want my player to be able to sit o
     

Player-Environment Interaction & Collision Handling in Unity

Simply put, how would you go about designing environmental interactions? For example, upon pressing the interact button when near a chair, he can sit on it. (Also works with NPCs functioning with NavMeshAgent component.)

For now, the interaction system works by raycasting towards players look direction and looking for Interactables and once an interactable is detected, the InputAction for Interact is able to perform its subscribed actions. So, now in my game, I want my player to be able to sit on a chair or sofa. The sofa interactable component already contains points where the Actor will sit and where it will stand up. (Not consider Stand To Sit & Sit to Stand animations for the time being.)

Flow => Walk Near Chair => Press Interact => Snap to Seating Position (with static sitting pose) => Disable Character Controls Until Canceled => Snap to standing Idle on Cancel.

The furniture already has a collider that blocks the Actors (Player & NPCs) from walking into it and is on a layer that only intractable reside in. The issue is that since both the Actor and the interactable have colliders in it, without disabling one or the other collider, the objects can't be put on each other (even forcefully through code, understandably so because of collisions, duh!)

Am I missing out something or how would you go about this situation to handle interactions that involve overlapping colliders?

❌
❌