News Forums RAIN General Discussion and Troubleshooting How to make custom aspect

This topic contains 1 reply, has 2 voices, and was last updated by  Shimakaze 3 months, 1 week ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #40329

    kingsapo
    Participant

    Hi! I’m using RAIN for an enemy which will detect a player flashlight (when on) by checking if its visual sensor can detect a mesh collider on a cone which lines up with the cone for the flashlight spotlight. However, the only visual aspect built into RAIN defines a single point for a sensor to check, not an entire mesh. I understand it should be possible to create a custom aspect given there is a page in the wiki for it (http://rivaltheory.com/wiki/customization/customaspect), but that page is currently blank. Does anyone have any boilerplate code for creating a custom aspect, or is there a better way for me to do this? Thank you.

    #40349

    Shimakaze
    Participant

    I have succeeded for this.
    The fast way is inherit VisualSensor to override “public override void Sense(string aspectName, MatchType matchType)”.
    And _matches is final target list you should assign.
    You can find other built-in variable and function by Intellisense.

    Score() is function return distance from target to your sensor.

    Best Regards.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.