-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Refactor RayPerception and add RayPerception2D #1793
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -28,7 +28,7 @@ public class BananaAgent : Agent | |||
public Material frozenMaterial; | |||
public GameObject myLaser; | |||
public bool contribute; | |||
private RayPerception rayPer; | |||
private RayPerception3D rayPer; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is going to break people's existing code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every major release involves breaking changes.
return degree * Mathf.PI / 180f; | ||
} | ||
} | ||
public class RayPerception : MonoBehaviour { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this supposed to be abstract ? Can this be made into an interface ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. It should be abstract. It is not an interface because it includes static helper methods, and a declarations for variables.
/// <param name="rayDistance">Radius of rays</param> | ||
/// <param name="rayAngles">Angles of rays (starting from (1,0) on unit circle).</param> | ||
/// <param name="detectableObjects">List of tags which correspond to object types agent can see</param> | ||
public List<float> Perceive(float rayDistance, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this have a unit test ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added.
/// <param name="detectableObjects">List of tags which correspond to object types agent can see</param> | ||
/// <param name="startOffset">Starting height offset of ray from center of agent.</param> | ||
/// <param name="endOffset">Ending height offset of ray from center of agent.</param> | ||
public override List<float> Perceive(float rayDistance, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this have a unit-test too ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
* Fix typos * Use abstract class for rayperception * Created RayPerception2D. (Unity-Technologies#1721) * Incorporate RayPerception2D * Fix typo * Make abstract class * Add tests
No description provided.