public SpinnerCollider(SpinnerComponent component, float height, ColliderInfo info) : this() { _header.Init(info, ColliderType.Spinner); var halfLength = component.Length * 0.5f; var radAngle = math.radians(component.Rotation); var sn = math.sin(radAngle); var cs = math.cos(radAngle); var v1 = new float2( component.Position.x - cs * (halfLength + PhysicsConstants.PhysSkin), // through the edge of the component.Position.y - sn * (halfLength + PhysicsConstants.PhysSkin) // spinner ); var v2 = new float2( component.Position.x + cs * (halfLength + PhysicsConstants.PhysSkin), // oversize by the ball radius component.Position.y + sn * (halfLength + PhysicsConstants.PhysSkin) // this will prevent clipping ); LineSeg0 = new LineCollider(v1, v2, height, height + 2.0f * PhysicsConstants.PhysSkin, info); LineSeg1 = new LineCollider(v2, v1, height, height + 2.0f * PhysicsConstants.PhysSkin, info); Bounds = LineSeg0.Bounds; }
public SpinnerColliderGenerator(SpinnerApi spinnerApi, SpinnerComponent component) { _api = spinnerApi; _component = component; }