Search Unity

Question Up-to-date collision sample/examples

Discussion in 'Physics for ECS' started by Waka-Takaki, Oct 13, 2021.

  1. Waka-Takaki

    Waka-Takaki

    Joined:
    Jan 19, 2014
    Posts:
    27
    Hi all,

    I'm brand new to unity physics with ECS. There's been many changes/improvements with the ECS API over the last few years from what I can tell, so much of the ECS/DOTS stuff online is out of date.

    Can anyone point me to a good resource that I can use to see how collision detection and events can be processed/handled in systems with the current API?

    I assumed I could just grab all my entities with physicsbodies etc. in an Entities.ForEach() and go from there, but I can't see any examples doing this and those components don't seem to have the necessary values.

    I see lots of examples of casts in the docs (which will be great in future) but for now I just want to start with handling collision/trigger events in ECS.

    Thanks in advance!
     
  2. DevViktoria

    DevViktoria

    Joined:
    Apr 6, 2021
    Posts:
    94
    Hi,

    I highly recommend to check out the ECSSamples github repository.
    https://github.com/Unity-Technologies/EntityComponentSystemSamples
    In this there is a UnityPhysicsSamples direcory with a lots of examples. The Assets/Demos/2. Setup/2d. Events/ directory contains great examples how to do collision detection for both colliders and triggers.

    Also you may check out the Turbo Makes Games channel (https://www.youtube.com/c/TurboMakesGames), he did a hole series of videos dedicated to ECS physics.
     
    NT_Ninetails likes this.