Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Officer_NotACop · Dec 16, 2014 at 01:54 AM · aienemy aisimulationsensor

RAIN AI motion detection limiting the visual sensor

I have an enemy called TRex that can follow the player with the RAIN package's built-in visual sensors. Like any TRex, it should not be able to detect the player if the player hasn't moved in a short amount of time. I have no idea how to begin writing a script for the TRex because the script has to reference the AI's visual sensor and the player.

A person on reddit gave me an example to initially fix my TRex because it wasn't following the player.

The code for the AI:

 <component version="1.1" type="RAIN.Core.AIRig"><fields><field value="True" type="System.Boolean" id="_showVisual" /><field value="True" type="System.Boolean" id="_useUnityMessages" /><field value="False" type="System.Boolean" id="_useFixedUpdate" /><field type="RAIN.Core.AI" reference="0" id="_ai" /></fields><references><reference type="RAIN.Core.AI" refcount="1" id="0"><field value="True" type="System.Boolean" id="_isActive" /><field type="UnityEngine.GameObject" id="_body" gameobject="0" /><field type="RAIN.Memory.BasicMemory" reference="1" id="_workingMemory" childrenvisible="False" /><field type="RAIN.Minds.BasicMind" reference="2" id="_mind" childrenvisible="False" /><field type="RAIN.Motion.BasicMotor" reference="3" id="_motor" childrenvisible="False" /><field type="RAIN.Animation.BasicAnimator" reference="4" id="_animator" childrenvisible="False" /><field type="RAIN.Navigation.BasicNavigator" reference="5" id="_navigator" childrenvisible="False" /><field type="RAIN.Perception.BasicSenses" reference="6" id="_senses" childrenvisible="True" /><field type="System.Collections.Generic.List" id="_customElements" elementtype="RAIN.Core.CustomAIElement" childrenvisible="False" /></reference><reference type="RAIN.Memory.BasicMemory" refcount="1" id="1"><field type="System.Collections.Generic.List" id="_memoryItems" elementtype="RAIN.Memory.BasicMemory+MemoryItem" /></reference><reference type="RAIN.Minds.BasicMind" refcount="1" id="2"><field type="RAIN.BehaviorTrees.BTAsset" id="_behaviorTreeAsset" gameobject="1" /><field type="System.Collections.Generic.List" id="_behaviorTreeBindings" elementtype="RAIN.BehaviorTrees.BTAssetBinding" /></reference><reference type="RAIN.Motion.BasicMotor" refcount="1" id="3"><field value="6" type="System.Single" id="_speed" /><field value="180" type="System.Single" id="_rotationSpeed" /><field value="0.1" type="System.Single" id="_closeEnoughDistance" /><field value="0.001" type="System.Single" id="_closeEnoughAngle" /><field value="90" type="System.Single" id="_faceBeforeMoveAngle" /><field value="0.5" type="System.Single" id="_stepUpHeight" /><field value="False" type="System.Boolean" id="_allow3DMovement" /><field value="False" type="System.Boolean" id="_allow3DRotation" /><field value="False" type="System.Boolean" id="_allowOffGraphMovement" /></reference><reference type="RAIN.Animation.BasicAnimator" refcount="1" id="4"><field type="System.Collections.Generic.List" id="_animationStates" elementtype="RAIN.Animation.BasicAnimator+BasicAnimatorState" /></reference><reference type="RAIN.Navigation.BasicNavigator" refcount="1" id="5"><field value="False" type="System.Boolean" id="_drawPaths" /><field value="100" type="System.Int32" id="_maxPathfindingSteps" /><field value="0" type="System.Single" id="_maxPathLength" /><field type="System.Collections.Generic.List" id="_graphTags" elementtype="System.String" /></reference><reference type="RAIN.Perception.BasicSenses" refcount="1" id="6"><field type="System.Collections.Generic.List" id="_sensors" elementtype="RAIN.Perception.Sensors.RAINSensor"><field type="RAIN.Perception.Sensors.VisualSensor" reference="7" id="element0" /></field></reference><reference type="RAIN.Perception.Sensors.VisualSensor" refcount="1" id="7"><field value="True" type="System.Boolean" id="_showVisual" /><field value="Sight" type="System.String" id="_sensorName" /><field value="True" type="System.Boolean" id="_isActive" /><field value="0.6,0,0,1" type="UnityEngine.Color" id="_sensorColor" /><field type="UnityEngine.Transform" id="_mountPoint" gameobject="2" /><field value="0,0,0" type="UnityEngine.Vector3" id="_positionOffset" /><field value="0,0,0" type="UnityEngine.Vector3" id="_angleOffset" /><field type="System.Collections.Generic.List" id="_filters" elementtype="RAIN.Perception.Sensors.Filters.RAINSensorFilter" /><field value="90" type="System.Single" id="_horizontalAngle" /><field value="360" type="System.Single" id="_verticalAngle" /><field value="28.63" type="System.Single" id="_range" /><field value="False" type="System.Boolean" id="_canDetectSelf" /><field value="True" type="System.Boolean" id="_lineOfSight" /><field value="512" type="UnityEngine.LayerMask" id="_lineOfSightMask" /></reference><reference type="RAIN.Perception.Sensors.Filters.NearestXFilter" refcount="0" id="8" /></references></component>

Edit: Took out the download link for the example project, even though it was legitimate.

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Officer_NotACop · Dec 16, 2014 at 01:38 AM 0
Share

I took out the download link even though it linked to a real project with no viruses. I really want to continue using the RAIN package because I've gotten far enough into the project with the package.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Prime · Dec 21, 2014 at 07:23 PM

It's a bit of a difficult problem generally, because some part of your game code needs to track movement of objects. If the T-Rex only cares about the player, then it isn't too bad. In RAIN, you could write a sensor filter that keeps a list of all objects that persist from frame to frame, along with their prior position. If the object change position, then it can be detected. If it doesn't, it is not returned in the detected list. That could be a bit expensive to compute if your sensor can detect a lot of objects, but won't be bad if it is limited to just a handful.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Kill character on impact 1 Answer

Can't properly duplicate an enemy AI 0 Answers

free roaming enemy ai 1 Answer

How do I rewrite this script to use an animator ? 0 Answers

Enemy walking off platform in 2D mode 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges