コード例 #1
0
 private static object _OverlapCircle(FPVector2 point, FP radius, Physics2D.BodySpecialSensor sensorType, int layerMask = UnityEngine.Physics.DefaultRaycastLayers)
 {
     return(OverlapGeneric(new Physics2D.CircleShape(radius, 1), point, sensorType, layerMask));
 }
コード例 #2
0
 /**
  *  @brief Returns all {@link TSCollider2D} within a circular area. Returns null if there is none.
  *
  *  @param point Center of the circle in world space.
  *  @param radius Radius of the circle.
  *  @param layerMask Unity's layer mask to filter objects.
  **/
 public static FPCollider2D[] OverlapCircleAll(FPVector2 point, FP radius, int layerMask = UnityEngine.Physics.DefaultRaycastLayers)
 {
     return((FPCollider2D[])_OverlapCircle(point, radius, Physics2D.BodySpecialSensor.ActiveAll, layerMask));
 }
コード例 #3
0
 /**
  *  @brief Cast a circle and returns an array {@link TSRaycastHit2D} with information about all {@link TSCollider2D} found. Returns null if there is none.
  *
  *  @param origin Origin of the circle in world space.
  *  @param radius Radius of the circle.
  *  @param direction Direction {@link FPVector2} of the cast.
  *  @param distance Max distance to reach.
  *  @param layerMask Unity's layer mask to filter objects.
  **/
 public static FPRaycastHit2D[] CircleCastAll(FPVector2 origin, FP radius, FPVector2 direction, FP distance, int layerMask = UnityEngine.Physics.DefaultRaycastLayers)
 {
     return((FPRaycastHit2D[])_CircleCast(origin, radius, direction, distance, Physics2D.BodySpecialSensor.ActiveAll, layerMask));
 }
コード例 #4
0
 public static FPRaycastHit2D[] RaycastAll(FPVector2 origin, FPVector2 direction, FP distance)
 {
     return(Physics2DWorldManager.instance.RaycastAll(origin, direction, distance));
 }
コード例 #5
0
 /**
  *  @brief Returns the first {@link TSCollider2D} within a box area. Returns null if there is none.
  *
  *  @param point Center of the box in world space.
  *  @param size Size of the box.
  *  @param angle Rotation angle in degrees of the box.
  *  @param layerMask Unity's layer mask to filter objects.
  **/
 public static FPCollider2D OverlapBox(FPVector2 point, FPVector2 size, FP angle, int layerMask = UnityEngine.Physics.DefaultRaycastLayers)
 {
     return((FPCollider2D)_OverlapBox(point, size, angle, Physics2D.BodySpecialSensor.ActiveOnce, layerMask));
 }
コード例 #6
0
 /**
  *  @brief Returns all {@link TSCollider2D} within a capsule area. Returns null if there is none.
  *
  *  @param point Center of the capsule in world space.
  *  @param size Size of the capsule.
  *  @param direction If it is a vertical or horizontal capsule.
  *  @param angle Rotation angle in degrees of the capsule.
  *  @param layerMask Unity's layer mask to filter objects.
  **/
 public static FPCollider2D[] OverlapCapsuleAll(FPVector2 point, FPVector2 size, TSCapsuleDirection2D direction, FP angle, int layerMask = UnityEngine.Physics.DefaultRaycastLayers)
 {
     return((FPCollider2D[])_OverlapCapsule(point, size, direction, angle, Physics2D.BodySpecialSensor.ActiveAll, layerMask));
 }
コード例 #7
0
 /**
  *  @brief Returns all {@link TSCollider2D} within a rectangular area. Returns null if there is none.
  *
  *  @param pointA Top-left corner of the rectangle.
  *  @param radius Bottom-right corner of the rectangle.
  *  @param layerMask Unity's layer mask to filter objects.
  **/
 public static FPCollider2D[] OverlapAreaAll(FPVector2 pointA, FPVector2 pointB, int layerMask = UnityEngine.Physics.DefaultRaycastLayers)
 {
     return((FPCollider2D[])_OverlapArea(pointA, pointB, Physics2D.BodySpecialSensor.ActiveAll, layerMask));
 }
コード例 #8
0
 /**
  *  @brief Returns the first {@link TSCollider2D} within a small circular area. Returns null if there is none.
  *
  *  @param point Center of the point in world space.
  *  @param layerMask Unity's layer mask to filter objects.
  **/
 public static FPCollider2D OverlapPoint(FPVector2 point, int layerMask = UnityEngine.Physics.DefaultRaycastLayers)
 {
     return((FPCollider2D)_OverlapCircle(point, POINT_RADIUS, Physics2D.BodySpecialSensor.ActiveOnce, layerMask));
 }
コード例 #9
0
 /**
  * @brief Instantiates a new prefab in a deterministic way.
  *
  * @param prefab GameObject's prefab to instantiate.
  * @param position Position to place the new GameObject.
  * @param rotation Rotation to set in the new GameObject.
  **/
 public static GameObject SyncedInstantiate(GameObject prefab, FPVector2 position, FPQuaternion rotation)
 {
     return(SyncedInstantiate(prefab, new FPVector(position.x, position.y, 0), rotation));
 }
コード例 #10
0
 /**
  * @brief Adds a new FPVector2 value.
  **/
 internal void AddFPVector2(byte key, FPVector2 value)
 {
     this.FPVectorTable2[key] = value;
 }
コード例 #11
0
 /**
  *  @brief Moves the body to a new position.
  **/
 public void MovePosition(FPVector2 position)
 {
     this.position = position;
 }
コード例 #12
0
 /**
  *  @brief Simulates the provided tourque in the body.
  *
  *  @param torque A {@link FPVector2} representing the torque to be applied.
  **/
 public void AddTorque(FPVector2 torque)
 {
     tsCollider.Body.TSApplyTorque(torque);
 }
コード例 #13
0
        /**
         *  @brief Returns the velocity of the body at some position in world space.
         **/
        public FPVector2 GetPointVelocity(FPVector2 worldPoint)
        {
            FPVector directionPoint = (position - tsCollider.Body.TSPosition).ToFPVector();

            return(FPVector.Cross(new FPVector(0, 0, tsCollider.Body.TSAngularVelocity), directionPoint).ToFPVector2() + tsCollider.Body.TSLinearVelocity);
        }
コード例 #14
0
 /**
  *  @brief Applies the provided force in the body.
  *
  *  @param force A {@link FPVector2} representing the force to be applied.
  *  @param position Indicates the location where the force should hit.
  **/
 public void AddForceAtPosition(FPVector2 force, FPVector2 position)
 {
     AddForceAtPosition(force, position, ForceMode.Impulse);
 }
コード例 #15
0
 /**
  *  @brief Applies the provided force in the body.
  *
  *  @param force A {@link FPVector2} representing the force to be applied.
  **/
 public void AddForce(FPVector2 force)
 {
     AddForce(force, ForceMode.Force);
 }