public Body(World world, Vector2 position = new Vector2(), float rotation = 0, BodyType bodyType = BodyType.Static, object userdata = null) { FixtureList = new List <Fixture>(); BodyId = _bodyIdCounter++; _world = world; _enabled = true; _awake = true; _sleepingAllowed = true; UserData = userdata; GravityScale = 1.0f; BodyType = bodyType; _xf.q.Set(rotation); //FPE: optimization if (position != Vector2.Zero) { _xf.p = position; _sweep.C0 = _xf.p; _sweep.C = _xf.p; } //FPE: optimization if (rotation != 0) { _sweep.A0 = rotation; _sweep.A = rotation; } world.AddBody(this); //FPE note: bodies can't live without a World }
public Body(World world, Vector2?position = null, float rotation = 0, object userdata = null) { FixtureList = new List <Fixture>(); BodyId = _bodyIdCounter++; World = world; UserData = userdata; GravityScale = 1.0f; AppendFlags(BodyFlags.AutoSleep); #if !USE_AWAKE_BODY_SET Awake = true; #endif BodyType = BodyType.Static; Enabled = true; Xf.q.Set(rotation); if (position.HasValue) { Xf.p = position.Value; Sweep.C0 = Xf.p; Sweep.C = Xf.p; Sweep.A0 = rotation; Sweep.A = rotation; } world.AddBody(this); }
public Body(World world) { FixtureList = new List <Fixture>(32); World = world; FixedRotation = false; IsBullet = false; SleepingAllowed = true; Awake = true; BodyType = BodyType.Static; Active = true; Xf.R.Set(0); world.AddBody(this); }
public Body(World world, Object userData) { FixtureList = new List <Fixture>(32); World = world; UserData = userData; FixedRotation = false; IsBullet = false; SleepingAllowed = true; Awake = true; BodyType = BodyType.Static; Enabled = true; Xf.R.Set(0); world.AddBody(this); }
public Body Clone() { Body body = new Body(); body.World = World; body.UserData = UserData; body.LinearDamping = LinearDamping; body.LinearVelocityInternal = LinearVelocityInternal; body.AngularDamping = AngularDamping; body.AngularVelocityInternal = AngularVelocityInternal; body.Position = Position; body.Rotation = Rotation; body._bodyType = _bodyType; body.Flags = Flags; World.AddBody(body); return(body); }
public Body(World world, PressPlay.FFWD.Components.Collider userData) { FixtureList = new List <Fixture>(32); BodyId = _bodyIdCounter++; World = world; UserData = userData; FixedRotation = false; IsBullet = false; SleepingAllowed = true; Awake = true; BodyType = BodyType.Static; Enabled = true; Xf.R.Set(0); world.AddBody(this); }
public Body(World world, object userData) { this.FixtureList = new List <Fixture>(32); this.BodyId = _bodyIdCounter++; this.World = world; this.UserData = userData; this.FixedRotation = false; this.IsBullet = false; this.SleepingAllowed = true; this.Awake = true; this.BodyType = BodyType.Static; this.Enabled = true; this.Xf.R.Set(0); world.AddBody(this); }
public Body(World world, DebugMaterial userData) { JointList = new List <Joint>(); FixtureList = new List <Fixture>(32); BodyId = _bodyIdCounter++; World = world; UserData = userData; FixedRotation = false; IsBullet = false; SleepingAllowed = true; Awake = true; BodyType = BodyType.Static; Enabled = true; Xf.R.Set(0); world.AddBody(this); }
public Body(World world, object userData) { FixtureList = new List <Fixture>(32); BodyId = _bodyIdCounter++; World = world; UserData = userData; FixedRotation = false; IsBullet = false; SleepingAllowed = true; #if !USE_AWAKE_BODY_SET Awake = true; #endif BodyType = BodyType.Static; Enabled = true; Xf.R.Set(0); world.AddBody(this); }
public Body(World world, Vector2?position = null, float rotation = 0, object userdata = null) { FixtureList = new List <Fixture>(); _world = world; UserData = userdata; GravityScale = 1.0f; BodyType = BodyType.Static; Enabled = true; //FPE note: Also creates proxies in the broadphase _xf.q.Set(rotation); if (position.HasValue) { _xf.p = position.Value; _sweep.C0 = _xf.p; _sweep.C = _xf.p; _sweep.A0 = rotation; _sweep.A = rotation; } world.AddBody(this); //FPE note: bodies can't live without a World }
public void PopulateWorld(World w) { foreach (Body b in bodyList) { b.setWorld(w); foreach (Fixture f in b.FixtureList) { f.Shape.ComputeProperties(); w.FixtureAdded(f); } float mass = b.Mass; //b.ResetMassData(); b.Mass = mass; b.Enabled = true; b.Awake = true; w.AddBody(b); //w.BodyList.Add(b); } w.ProcessChanges(); foreach (Joint j in jointList) { w.AddJoint(j); } w.ProcessChanges(); }
public Body(World world, object userData) { FixtureList = new List<Fixture>(32); BodyId = _bodyIdCounter++; World = world; UserData = userData; FixedRotation = false; IsBullet = false; SleepingAllowed = true; Awake = true; BodyType = BodyType.Static; Enabled = true; Xf.R.Set(0); world.AddBody(this); }
public Body(World world, Vector2? position = null, float rotation = 0, object userdata = null) { FixtureList = new List<Fixture>(); _world = world; UserData = userdata; GravityScale = 1.0f; BodyType = BodyType.Static; Enabled = true; //FPE note: Also creates proxies in the broadphase _xf.q.Set(rotation); if (position.HasValue) { _xf.p = position.Value; _sweep.C0 = _xf.p; _sweep.C = _xf.p; _sweep.A0 = rotation; _sweep.A = rotation; } world.AddBody(this); //FPE note: bodies can't live without a World }
public Body(World world, Vector2? position = null, float rotation = 0, object userdata = null) { FixtureList = new List<Fixture>(); BodyId = _bodyIdCounter++; World = world; UserData = userdata; GravityScale = 1.0f; AppendFlags(BodyFlags.AutoSleep); #if !USE_AWAKE_BODY_SET Awake = true; #endif BodyType = BodyType.Static; Enabled = true; Xf.q.Set(rotation); if (position.HasValue) { Xf.p = position.Value; Sweep.C0 = Xf.p; Sweep.C = Xf.p; Sweep.A0 = rotation; Sweep.A = rotation; } world.AddBody(this); }
public Body(World world, Vector2 position = new Vector2(), float rotation = 0, BodyType bodyType = BodyType.Static, object userdata = null) { FixtureList = new List<Fixture>(); BodyId = _bodyIdCounter++; _world = world; _enabled = true; _awake = true; _sleepingAllowed = true; UserData = userdata; GravityScale = 1.0f; BodyType = bodyType; _xf.q.Set(rotation); //FPE: optimization if (position != Vector2.Zero) { _xf.p = position; _sweep.C0 = _xf.p; _sweep.C = _xf.p; } //FPE: optimization if (rotation != 0) { _sweep.A0 = rotation; _sweep.A = rotation; } world.AddBody(this); //FPE note: bodies can't live without a World }
public Body(World world, object userData) { FixtureList = new List<Fixture>(32); BodyId = _bodyIdCounter++; World = world; UserData = userData; GravityScale = 1.0f; FixedRotation = false; IsBullet = false; SleepingAllowed = true; #if !USE_AWAKE_BODY_SET Awake = true; #endif BodyType = BodyType.Static; Enabled = true; Xf.q.Set(0); world.AddBody(this); }