public BaseWeatherMapper(GlonassContext context) { _context = context; _fsHelper = new FSHelper(); featured.Columns.Add("DateTime", typeof(DateTime)); FillDictionary(); }
private void FixedUpdate() { if (fuel > 0) { Vector3 p0 = car.transform.TransformPoint(new Vector3(LocalAnchorB.x, LocalAnchorB.y, -5f)); backBody.PhysicsBody.ApplyTorque(-movement * speed * Time.fixedDeltaTime); if (Input.GetKeyDown(KeyCode.Space)) { car.PhysicsBody.ApplyForce(jumpPow * FSHelper.Vector2ToFVector2(jumpForce), FSHelper.Vector3ToFVector2(p0)); } } else { StartCoroutine("OpenMenu"); } fuel -= fuelConsumption * Mathf.Abs(movement) * Time.fixedDeltaTime; if (Input.GetKey(KeyCode.K)) { car.PhysicsBody.ApplyTorque(-rotationPow * speed * Time.fixedDeltaTime); } if (Input.GetKey(KeyCode.J)) { car.PhysicsBody.ApplyTorque(rotationPow * speed * Time.fixedDeltaTime); } if (fuel <= 0) { Debug.Log("You have failed"); } }
/// <summary> /// Start a new application using manifest metadata /// </summary> /// <param name="manifest">Application manifest</param> /// <returns></returns> public ApplicationProcess StartApplication(AppManifest manifest) { string viewLocation = FSHelper.NormalizeLocation($"{manifest.Location}\\{manifest.MainPage}"); Log($"Starting application from package '{manifest.Domain}'"); if (!File.Exists(viewLocation)) { throw new LauncherException($"Failed to start application '{manifest.Name}' ({manifest.Domain}). View not found."); } ApplicationProcess proc = ProcessManager.GetInstance().CreateProcess(); proc.Name = manifest.Name; proc.Domain = manifest.Domain; proc.DomainPath = manifest.Location; // TODO: Add icon loader proc.Host.ViewName = manifest.MainPage; proc.Host.Styles = manifest.Window; proc.Host.Label = manifest.Name; proc.Start(); proc.Host.Show(); return(proc); }
public override void InitJoint() { base.InitJoint(); //B tekerlek //A araba //jesus %99 em-in Vector3 p0 = BodyB.transform.TransformPoint(new Vector3(LocalAnchorB.x, LocalAnchorB.y, -5f)); joint = JointFactory.CreateWheelJoint(FSWorldComponent.PhysicsWorld, BodyA.PhysicsBody, BodyB.PhysicsBody, BodyB.PhysicsBody.GetLocalPoint(FSHelper.Vector3ToFVector2(p0)), FSHelper.Vector2ToFVector2(axis)); //UnitY ile yanlış yapıyor olabilirim joint.MaxMotorTorque = MaxMotorTorque; joint.MotorEnabled = MotorEnabled; joint.MotorSpeed = MotorSpeed; joint.SpringDampingRatio = springDampingRatio; joint.SpringFrequencyHz = springFrequency; joint.CollideConnected = false; // }
void OnDrawGizmos() { if (lastContacts == null) { return; } foreach (Contact lastContact in lastContacts) { if (!lastContact.IsTouching()) { return; } FarseerPhysics.Common.FixedArray2 <FVector2> contactPoints; FVector2 normal; lastContact.GetWorldManifold(out normal, out contactPoints); Vector3 p0 = FSHelper.FVector2ToVector3(contactPoints[0]); Vector3 p1 = FSHelper.FVector2ToVector3(contactPoints[1]); Vector3 pn = FSHelper.FVector2ToVector3(normal); Gizmos.color = Color.red; Gizmos.DrawWireSphere(p0, 0.15f); Gizmos.DrawLine(p0, p0 + pn * 2f); Gizmos.color = Color.yellow; Gizmos.DrawWireSphere(p1, 0.15f); Gizmos.DrawLine(p1, p1 + pn * 2f); } }
protected virtual void ConvertToConvex(FSConcaveShapeComponent targetCSC) { FSShapeComponent[] childcomps = targetCSC.GetComponentsInChildren <FSShapeComponent>(); if (childcomps != null) { if (childcomps.Length > 0) { for (int i = 0; i < childcomps.Length; i++) { if (childcomps[i] == null) { continue; } if (childcomps[i].gameObject == null) { continue; } DestroyImmediate(childcomps[i].gameObject); } } } // convert vertices FarseerPhysics.Common.Vertices concaveVertices = new FarseerPhysics.Common.Vertices(); if (targetCSC.PointInput == FSShapePointInput.Transform) { for (int i = 0; i < targetCSC.TransformPoints.Length; i++) { concaveVertices.Add(FSHelper.Vector3ToFVector2(targetCSC.TransformPoints[i].localPosition)); } } List <FarseerPhysics.Common.Vertices> convexShapeVs = FarseerPhysics.Common.Decomposition.BayazitDecomposer.ConvexPartition(concaveVertices); for (int i = 0; i < convexShapeVs.Count; i++) { GameObject newConvShape = new GameObject("convexShape" + i.ToString()); newConvShape.transform.parent = targetCSC.transform; newConvShape.transform.localPosition = Vector3.zero; newConvShape.transform.localRotation = Quaternion.Euler(Vector3.zero); newConvShape.transform.localScale = Vector3.one; FSShapeComponent shape0 = newConvShape.AddComponent <FSShapeComponent>(); shape0.CollidesWith = targetCSC.CollidesWith; shape0.CollisionFilter = targetCSC.CollisionFilter; shape0.BelongsTo = targetCSC.BelongsTo; shape0.CollisionGroup = targetCSC.CollisionGroup; shape0.Friction = targetCSC.Friction; shape0.Restitution = targetCSC.Restitution; shape0.Density = targetCSC.Density; shape0.UseUnityCollider = false; shape0.PolygonPoints = new Transform[convexShapeVs[i].Count]; for (int j = 0; j < convexShapeVs[i].Count; j++) { GameObject pnew = new GameObject("p" + j.ToString()); pnew.transform.parent = shape0.transform; pnew.transform.localPosition = FSHelper.FVector2ToVector3(convexShapeVs[i][j]); shape0.PolygonPoints[j] = pnew.transform; } } }
public FSProvider() { Database db = new Database(); KGramsManager kGramManager = new KGramsManager(db); FSHelper fsHelper = new FSHelper(kGramManager, db); fsSearching = new FSSearching(db, fsHelper); fsInserting = new FSInserting(db, fsHelper, kGramManager); }
public static FDVertex FromLine(FVector2 begin, FVector2 end, Color color) { FDVertex fv = new FDVertex(); fv.Position = new Vector3[2]; fv.Position[0] = FSHelper.FVector2ToVector3(begin); fv.Position[1] = FSHelper.FVector2ToVector3(end); fv.Color = color; return(fv); }
public HostConfiguration() { DebugModeEnabled = !false; string currentDirectory = AppDomain.CurrentDomain.BaseDirectory; LogFile = FSHelper.NormalizeLocation($"{currentDirectory}\\log.txt"); SystemPackagesLocation = FormatPath(currentDirectory, PackagesDirectoryName); GlobalPackagesLocation = FormatPath(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), PackagesDirectoryName); LocalPackagesLocation = FormatPath(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), PackagesDirectoryName); }
public static FDVertex FromTriangleList(FVector2 p0, FVector2 p1, FVector2 p2, Color color) { FDVertex fv = new FDVertex(); fv.Position = new Vector3[3]; fv.Position[0] = FSHelper.FVector2ToVector3(p0); fv.Position[1] = FSHelper.FVector2ToVector3(p1); fv.Position[2] = FSHelper.FVector2ToVector3(p2); fv.Color = color; return(fv); }
private bool OnCollisionEvent(FSFixture fixtureA, FSFixture fixtureB, Contact contact) { FSBody bodyB = fixtureB.Body; //if (bodyB.UserTag == "Respawn") { FVector2 normal; FarseerPhysics.Common.FixedArray2 <FVector2> contactPoints; contact.GetWorldManifold(out normal, out contactPoints); bodyB.SetTransform(FSHelper.Vector3ToFVector2(RespawnPosition.position), 0f); bodyB.ResetDynamics(); //} return(true); }
public override void InitJoint() { base.InitJoint(); Vector3 p0 = BodyA.transform.TransformPoint(new Vector3(LocalAnchorA.x, LocalAnchorA.y, -5f)); Vector3 p1 = BodyB.transform.TransformPoint(new Vector3(LocalAnchorB.x, LocalAnchorB.y, -5f)); joint = JointFactory.CreatePulleyJoint(FSWorldComponent.PhysicsWorld, BodyA.PhysicsBody, BodyB.PhysicsBody, FSHelper.Vector3ToFVector2(GroundAnchorA.position), FSHelper.Vector3ToFVector2(GroundAnchorB.position), BodyA.PhysicsBody.GetLocalPoint(FSHelper.Vector3ToFVector2(p0)), BodyB.PhysicsBody.GetLocalPoint(FSHelper.Vector3ToFVector2(p1)), ForceRatio); joint.CollideConnected = CollideConnected; }
private PolygonShape GetPolyShape() { // if this GameObject contains the FSBodyComponent there is no need to adjust the colliders bool hasFsBody = GetComponent <FSBodyComponent>() != null; var shapePoints = new List <FVector2>(); if (UseUnityCollider) { if (!GetColliderMeasurements(hasFsBody, ref shapePoints)) { return(null); } } else { if (UseTransforms) { if (PolygonTransforms.Length < 3) { return(null); } foreach (Transform t in PolygonTransforms) { shapePoints.Add(hasFsBody ? FSHelper.Vector3ToFVector2(t.localPosition) : FSHelper.Vector3ToFVector2(FSHelper.LocalTranslatedVec3( transform.parent.InverseTransformPoint(t.position), transform.parent))); } } else { if (PolygonCoordinates.Length < 3) { return(null); } foreach (Vector2 t in PolygonCoordinates) { shapePoints.Add(hasFsBody ? FSHelper.Vector3ToFVector2(t) : FSHelper.Vector3ToFVector2(t)); } } } return(new PolygonShape(new Vertices(shapePoints.ToArray()), Density)); }
public override void InitJoint() { base.InitJoint(); // Vector3 p0 = BodyB.transform.TransformPoint(new Vector3(LocalAnchorB.x, LocalAnchorB.y, -5f)); joint = JointFactory.CreateRevoluteJoint(FSWorldComponent.PhysicsWorld, BodyA.PhysicsBody, BodyB.PhysicsBody, BodyB.PhysicsBody.GetLocalPoint(FSHelper.Vector3ToFVector2(p0))); joint.CollideConnected = CollideConnected; joint.LowerLimit = LowerLimit * Mathf.Deg2Rad; joint.UpperLimit = UpperLimit * Mathf.Deg2Rad; joint.LimitEnabled = LimitEnabled; joint.MaxMotorTorque = MaxMotorTorque; joint.MotorSpeed = MotorSpeed; joint.MotorEnabled = MotorEnabled; }
/// <summary> /// Read manifest file /// </summary> /// <param name="filePath">File path</param> /// <returns></returns> protected async Task <AppManifest> ReadManifestAsync(string filePath) { string savePath = FSHelper.NormalizeLocation(filePath); string result; using (StreamReader reader = File.OpenText(savePath)) { result = await reader.ReadToEndAsync(); } try { AppManifest manifest = JsonConvert.DeserializeObject <AppManifest>(result); manifest.Location = Path.GetDirectoryName(filePath); return(manifest); } catch (Exception ex) { LogError($"Corrupted app manifest at '{savePath}'. Error: {ex.Message}"); return(null); } }
private bool GetColliderMeasurements(bool hasFsBody, ref List <FVector2> shapePoints) { // TODO: Add support for capsule colliders var box = GetComponent <BoxCollider>(); if (box == null) { return(false); } Vector3 scale = transform.lossyScale; // Added support for collider center offset (has to convert to local first) var center = transform.InverseTransformPoint(box.bounds.center); // Top left to Top Right points, counter-clockwise var v00l = new Vector3(-box.size.x * 0.5f, -box.size.y * 0.5f) + center; var v01l = new Vector3(box.size.x * 0.5f, -box.size.y * 0.5f) + center; var v02l = new Vector3(box.size.x * 0.5f, box.size.y * 0.5f) + center; var v03l = new Vector3(-box.size.x * 0.5f, box.size.y * 0.5f) + center; v00l.Scale(scale); v01l.Scale(scale); v02l.Scale(scale); v03l.Scale(scale); Vector3 v00 = hasFsBody ? v00l : FSHelper.LocalTranslatedVec3(v00l, transform); Vector3 v01 = hasFsBody ? v01l : FSHelper.LocalTranslatedVec3(v01l, transform); Vector3 v02 = hasFsBody ? v02l : FSHelper.LocalTranslatedVec3(v02l, transform); Vector3 v03 = hasFsBody ? v03l : FSHelper.LocalTranslatedVec3(v03l, transform); shapePoints.Add(FSHelper.Vector3ToFVector2(v00)); shapePoints.Add(FSHelper.Vector3ToFVector2(v01)); shapePoints.Add(FSHelper.Vector3ToFVector2(v02)); shapePoints.Add(FSHelper.Vector3ToFVector2(v03)); return(true); }
public FSInserting(Database database, FSHelper fsHelper, KGramsManager kGramManager) { this.database = database; this.fsHelper = fsHelper; this.kGramManager = kGramManager; }
private PolygonsImporter() { Polygons = new List <PolygonViewModel>(); _fSHelper = new FSHelper(); }
static void Main(string[] args) { _logger = Logger.GetInstance(); _fsHelper = new FSHelper(); _logger.PrintMilestone("Reading configuration..."); string datasetPath = ConfigurationManager.AppSettings.Get("path_dataset"); string attributesPath = ConfigurationManager.AppSettings.Get("path_attributes"); string unused_consequents_path = ConfigurationManager.AppSettings.Get("path_unused"); string itemsetPathFormat = ConfigurationManager.AppSettings.Get("path_itemset_format"); string rulesPathFormat = ConfigurationManager.AppSettings.Get("path_rules_format"); _logger.PrintMilestone("Configuration successfully read."); _miner = new Miner(); _logger.PrintMilestone("Started execution. Reading dataset."); var dt = _fsHelper.GetDataSet(datasetPath, ";"); _logger.PrintExecutionTime("Loaded dataset."); _logger.PrintMilestone("Reading attributes."); consequents = _fsHelper.LoadUnusedConsequents(unused_consequents_path); attributes = _fsHelper.GetAttributesList(attributesPath, unused_consequents_path); foreach (DataRow tRow in dt.Rows) { foreach (var att in attributes) { att.Add(tRow[att.Name].ToString(), tRow["id"].ToString()); } } SaveAsFeatures(dt, @"E:\Data\featurebundle.txt"); dt.Dispose(); _logger.PrintExecutionTime("Attributes read."); Attribute.TotalElements = dt.Rows.Count; _logger.PrintMilestone("Starting to combine attributes..."); _logger.BeginLap(); // Get initial, 2-tier itemsets to build the rest on them. CombineAttributesAndValues(attributes.ToArray(), 0, attributes.Count - 1, 0, 2); _logger.PrintLap(string.Format("Generated {0}-tier itemsets ({1} entries).", 2, currentTierItemsets.Count)); SubmitItemset(); _fsHelper.SaveItemsets(lastTierItemsets, string.Format(itemsetPathFormat, 2)); for (int i = 3; i < attributes.Count; i++) { foreach (Itemset itemset in lastTierItemsets) { CombineAttributeWithItemset(itemset, attributes.ToArray()); } SubmitItemset(); if (lastTierItemsets.Count > 0) { _logger.PrintLap(string.Format("Generated {0}-tier itemsets ({1} entries).", i, lastTierItemsets.Count)); _fsHelper.SaveItemsets(lastTierItemsets, string.Format(itemsetPathFormat, i)); } else { lastItemsetTier = i - 1; _logger.PrintMilestone(string.Format("No itemsets found for Tier {0}. No further itemsets will be generated.", i)); break; } } _logger.PrintExecutionTime(string.Format("Generated itemsets, {0} entries total.", itemsets.Count)); _logger.PrintMilestone("Starting rules generation..."); _logger.BeginLap(); for (var i = 2; i <= lastItemsetTier; i++) { var tier = _fsHelper.LoadItemsets(string.Format(itemsetPathFormat, i)).OrderBy(x => x.Support).ToArray(); foreach (Itemset itemset in tier) { BuildRules(itemset); } _logger.PrintLap(string.Format("Generated {0}-tier rules.", i)); } _logger.PrintMilestone(string.Format("Ended rules generation. Total: {0} rules.", rules.Count())); var ordered = rules.OrderByDescending(x => x.confidence).ToArray(); System.IO.File.WriteAllLines(string.Format(rulesPathFormat, MinSupport, MinConfidence), ordered.Select(x => x.ToString())); }
public FSSearching(Database database, FSHelper fsHelper) { this.database = database; this.fsHelper = fsHelper; }
protected PolygonShape GetPolyShape() { // if this GameObject contains the FSBodyComponent // then there is no need to adjust the colliders! bool isBody = GetComponent <FSBodyComponent>() != null; List <FVector2> vs = new List <FVector2>(); if (UseUnityCollider) { BoxCollider bc = this.GetComponent <BoxCollider>(); if (bc == null) { return(null); } Vector3 scale = transform.lossyScale; //Debug.Log("SCALE: " + scale); Vector3 v00l = new Vector3(-bc.size.x * 0.5f, -bc.size.y * 0.5f); Vector3 v01l = new Vector3(bc.size.x * 0.5f, -bc.size.y * 0.5f); Vector3 v02l = new Vector3(bc.size.x * 0.5f, bc.size.y * 0.5f); Vector3 v03l = new Vector3(-bc.size.x * 0.5f, bc.size.y * 0.5f); v00l.Scale(scale); v01l.Scale(scale); v02l.Scale(scale); v03l.Scale(scale); Vector3 v00 = isBody ? v00l : FSHelper.LocalTranslatedVec3(v00l, this.transform); //v00.Scale(scale); Vector3 v01 = isBody ? v01l : FSHelper.LocalTranslatedVec3(v01l, this.transform); //v01.Scale(scale); Vector3 v02 = isBody ? v02l : FSHelper.LocalTranslatedVec3(v02l, this.transform); //v02.Scale(scale); Vector3 v03 = isBody ? v03l : FSHelper.LocalTranslatedVec3(v03l, this.transform); //v03.Scale(scale); vs.Add(FSHelper.Vector3ToFVector2(v00)); vs.Add(FSHelper.Vector3ToFVector2(v01)); vs.Add(FSHelper.Vector3ToFVector2(v02)); vs.Add(FSHelper.Vector3ToFVector2(v03)); } else { if (PolygonPoints.Length < 3) { return(null); } //vs = new Vertices(); for (int i = 0; i < PolygonPoints.Length; i++) { if (!isBody) { // updated! // now the points can be anywhere Vector3 localp = transform.parent.InverseTransformPoint(PolygonPoints[i].position); vs.Add(FSHelper.Vector3ToFVector2(FSHelper.LocalTranslatedVec3(localp, this.transform.parent))); // not doing this way anymore because this way points couldn't be shared betweeen shapes //vs.Add(FSHelper.Vector3ToFVector2(FSHelper.LocalTranslatedVec3(PolygonPoints[i].localPosition, this.transform))); } else { vs.Add(FSHelper.Vector3ToFVector2(PolygonPoints[i].localPosition)); } } } return(new PolygonShape(new Vertices(vs.ToArray()), Density)); }
protected string GetResourceFullPath(string resourceName) { return(FSHelper.NormalizeLocation($"{AppProcess.DomainPath}\\{resourceName}")); }
/// <summary> /// Get cache file path for specific directory /// </summary> /// <param name="directoryPath"></param> /// <returns></returns> private string GetCacheFilePath(string directoryPath) { return(FSHelper.NormalizeLocation($"{directoryPath}\\{CacheFileName}")); }
public Miner() { _logger = Logger.GetInstance(); _fsHelper = new FSHelper(); }
public void ConvertToConvex() { FSShapeComponent[] childFsShapes = GetComponentsInChildren <FSShapeComponent>(); foreach (FSShapeComponent shapeComponent in childFsShapes) { if (shapeComponent.gameObject == null) { continue; } DestroyImmediate(shapeComponent.gameObject); } // convert vertices var concaveVertices = new FarseerPhysics.Common.Vertices(); if (PointInput == FSShapePointInput.Transform) { for (int i = 0; i < PointsTransforms.Length; i++) { concaveVertices.Add(FSHelper.Vector3ToFVector2(PointsTransforms[i].localPosition)); } } if (PointInput == FSShapePointInput.Vector2List) { foreach (var coordinate in PointsCoordinates) { concaveVertices.Add(FSHelper.Vector2ToFVector2(transform.TransformPoint(coordinate))); } } List <FarseerPhysics.Common.Vertices> convexShapeVs = FarseerPhysics.Common.Decomposition.BayazitDecomposer.ConvexPartition(concaveVertices); for (int i = 0; i < convexShapeVs.Count; i++) { var newConvShape = new GameObject("convexShape" + i.ToString()); newConvShape.transform.parent = transform; newConvShape.transform.localPosition = Vector3.zero; newConvShape.transform.localRotation = Quaternion.Euler(Vector3.zero); newConvShape.transform.localScale = Vector3.one; var shapeComponent = newConvShape.AddComponent <FSShapeComponent>(); shapeComponent.CollidesWith = CollidesWith; shapeComponent.CollisionFilter = CollisionFilter; shapeComponent.BelongsTo = BelongsTo; shapeComponent.CollisionGroup = CollisionGroup; shapeComponent.Friction = Friction; shapeComponent.Restitution = Restitution; shapeComponent.Density = Density; shapeComponent.UseUnityCollider = false; shapeComponent.UseTransforms = (PointInput == FSShapePointInput.Transform); if (PointInput == FSShapePointInput.Transform) { shapeComponent.PolygonTransforms = new Transform[convexShapeVs[i].Count]; for (int j = 0; j < convexShapeVs[i].Count; j++) { var pnew = new GameObject("p" + j.ToString(CultureInfo.InvariantCulture)); pnew.transform.parent = shapeComponent.transform; pnew.transform.localPosition = FSHelper.FVector2ToVector3(convexShapeVs[i][j]); shapeComponent.PolygonTransforms[j] = pnew.transform; } } else { shapeComponent.PolygonCoordinates = new Vector2[convexShapeVs[i].Count]; for (int j = 0; j < convexShapeVs[i].Count; j++) { shapeComponent.PolygonCoordinates[j] = newConvShape.transform.InverseTransformPoint(FSHelper.FVector2ToVector3(convexShapeVs[i][j])); } } } }
public void Start() { if (this.body != null) { return; } var rigid = this.GetComponent <Rigidbody2D>(); if (rigid != null) { if (rigid.bodyType == RigidbodyType2D.Static) { this._bodyDef.BodyType = BodyType.StaticBody; } if (rigid.bodyType == RigidbodyType2D.Kinematic) { this._bodyDef.BodyType = BodyType.KinematicBody; } if (rigid.bodyType == RigidbodyType2D.Dynamic) { this._bodyDef.BodyType = BodyType.DynamicBody; } this.useAutoMass = rigid.useAutoMass; this.inertia = rigid.inertia; this.mass = rigid.mass; this.GravityScale = rigid.gravityScale; this.drag = rigid.drag; this.angularDrag = rigid.angularDrag; this._massData.Center = rigid.centerOfMass.ToVector2(); Object.Destroy(rigid); } World world = PhysicsFight.instance.World; //body = BodyFactory.CreateRectangle(FSWorldComponent.PhysicsWorld, 1f, 1f, Density); body = world.CreateBody(this._bodyDef); var colliders = this.GetComponents <UnityEngine.Collider2D>(); for (int i = 0; i < colliders.Length; i++) { if (colliders[i] is BoxCollider2D) { var shape = FSHelper.GetBoxShape(colliders[i] as BoxCollider2D); Fixture f = body.CreateFixture(shape, colliders[i].density); this.UpdateFixture(f, colliders[i]); f.Friction = colliders[i].friction; f.Restitution = colliders[i].bounciness; f.IsSensor = colliders[i].isTrigger; } else if (colliders[i] is CircleCollider2D) { var shape = FSHelper.GetCircleShape(colliders[i] as CircleCollider2D); Fixture f = body.CreateFixture(shape, colliders[i].density); this.UpdateFixture(f, colliders[i]); f.Friction = colliders[i].friction; f.Restitution = colliders[i].bounciness; f.IsSensor = colliders[i].isTrigger; } else if (colliders[i] is PolygonCollider2D) { var shapes = FSHelper.GetPolygonShape(colliders[i] as PolygonCollider2D); for (int j = 0; j < shapes.Length; j++) { Fixture f = body.CreateFixture(shapes[j], colliders[i].density); this.UpdateFixture(f, colliders[i]); f.Friction = colliders[i].friction; f.Restitution = colliders[i].bounciness; f.IsSensor = colliders[i].isTrigger; } } } body.IgnoreGravity = !this._useGravity; body.CollisionCategories = this._collisionCategories; body.CollidesWith = this._collidesWith; //body.IsBullet = true; body.SetTransform(new System.Numerics.Vector2(transform.position.x, transform.position.y), transform.rotation.eulerAngles.z * Mathf.Deg2Rad); body.Scale = transform.lossyScale.ToVector2(); body.UseAutoMass = this._useAutoMass; body.SetMassData(_massData); body.LinearVelocity = this._velocity; body.AngularVelocity = this._angularVelocity; body.IsEnabled = true; body.IsBullet = false; PhysicsFight.instance.AddBody(body, this.gameObject); }
/// <summary> /// Sets the local anchor b at runtime. /// </summary> /// <param name='value'> /// Value. /// </param> public void SetLocalAnchorB(Vector2 value) { LocalAnchorB = value; joint.LocalAnchorB = FSHelper.Vector2ToFVector2(value); }