No announcement yet.

Pattern for all pair-wise collisions

  • Filter
  • Time
  • Show
Clear All
new posts

    Pattern for all pair-wise collisions

    I am very new to UnReal. I'm curious to know if there is a common pattern for pair-wise collisions. For instance in [this tutorial]( you learn how to create a SphereComponent to detect interactions with other objects via the "Hit" class.

    Here is my basic scenario. I will have multiple agents moving about on their own initiative. I expect them to come with a certain distance of each other. When they do, they will greet, learn the others name, and move on. I know I can use the SphereComponent to detect when another agent is nearby. However, I still don't know

    1. How to only check once for each pair. E.g., do Bill and Carmen make two interactions, one initiated from each.
    2. How does Bill get information from Carmen's class. Something of the form Bill.addToKnownNames(, but I don't have any examples of this.

    I'm sure this is common. I would appreciate any and all help.
    Creating a variety of components and attaching them to a customized pawn.

    Technically you can handle both of these at once.

    //In your header file for your Bill/Carmen class.
    UPROPERTY(EditAnywhere, Category = "Name")
    FName MyName;
    TArray<FName> KnownNames;
    // In your code where you are grabbing the collision.
    if (AMyActor* HitPerson = Cast<AMyActor>(Hit.GetActor())
       if (!KnownNames.Contains(HitPerson->MyName)
              // New entry!
    Able Ability System - A high performance, robust ability system for UE4. Now Available!