// Cache here per time step to reduce cache misses. // final Vec2 m_localCenterA, m_localCenterB; // float m_invMassA, m_invIA; // float m_invMassB, m_invIB; protected internal Joint(IWorldPool argWorldPool, JointDef def) { Debug.Assert(def.BodyA != def.BodyB); Pool = argWorldPool; Type = def.Type; Prev = null; Next = null; BodyA = def.BodyA; BodyB = def.BodyB; CollideConnected = def.CollideConnected; IslandFlag = false; UserData = def.UserData; Index = 0; EdgeA = new JointEdge(); EdgeA.Joint = null; EdgeA.Other = null; EdgeA.Prev = null; EdgeA.Next = null; EdgeB = new JointEdge(); EdgeB.Joint = null; EdgeB.Other = null; EdgeB.Prev = null; EdgeB.Next = null; // m_localCenterA = new Vec2(); // m_localCenterB = new Vec2(); }
// Cache here per time step to reduce cache misses. // final Vec2 m_localCenterA, m_localCenterB; // float m_invMassA, m_invIA; // float m_invMassB, m_invIB; protected internal Joint(IWorldPool argWorldPool, JointDef def) { Debug.Assert(def.bodyA != def.bodyB); pool = argWorldPool; m_type = def.type; m_prev = null; m_next = null; m_bodyA = def.bodyA; m_bodyB = def.bodyB; m_collideConnected = def.collideConnected; m_islandFlag = false; m_userData = def.userData; m_index = 0; m_edgeA = new JointEdge(); m_edgeA.joint = null; m_edgeA.other = null; m_edgeA.prev = null; m_edgeA.next = null; m_edgeB = new JointEdge(); m_edgeB.joint = null; m_edgeB.other = null; m_edgeB.prev = null; m_edgeB.next = null; // m_localCenterA = new Vec2(); // m_localCenterB = new Vec2(); }
public Body(BodyDef bd, World world) { Debug.Assert(bd.position.Valid); Debug.Assert(bd.linearVelocity.Valid); Debug.Assert(bd.gravityScale >= 0.0f); Debug.Assert(bd.angularDamping >= 0.0f); Debug.Assert(bd.linearDamping >= 0.0f); m_flags = 0; if (bd.bullet) { m_flags |= e_bulletFlag; } if (bd.fixedRotation) { m_flags |= e_fixedRotationFlag; } if (bd.allowSleep) { m_flags |= e_autoSleepFlag; } if (bd.awake) { m_flags |= e_awakeFlag; } if (bd.active) { m_flags |= e_activeFlag; } m_world = world; m_xf.p.set_Renamed(bd.position); m_xf.q.set_Renamed(bd.angle); m_sweep.localCenter.setZero(); m_sweep.c0.set_Renamed(m_xf.p); m_sweep.c.set_Renamed(m_xf.p); m_sweep.a0 = bd.angle; m_sweep.a = bd.angle; m_sweep.alpha0 = 0.0f; m_jointList = null; m_contactList = null; m_prev = null; m_next = null; m_linearVelocity.set_Renamed(bd.linearVelocity); m_angularVelocity = bd.angularVelocity; m_linearDamping = bd.linearDamping; m_angularDamping = bd.angularDamping; m_gravityScale = bd.gravityScale; m_force.setZero(); m_torque = 0.0f; m_sleepTime = 0.0f; m_type = bd.type; if (m_type == BodyType.DYNAMIC) { m_mass = 1f; m_invMass = 1f; } else { m_mass = 0f; m_invMass = 0f; } m_I = 0.0f; m_invI = 0.0f; m_userData = bd.userData; m_fixtureList = null; m_fixtureCount = 0; }
// Cache here per time step to reduce cache misses. // final Vec2 m_localCenterA, m_localCenterB; // float m_invMassA, m_invIA; // float m_invMassB, m_invIB; protected internal Joint(IWorldPool argWorldPool, JointDef def) { Debug.Assert(def.BodyA != def.BodyB); Pool = argWorldPool; Type = def.Type; Prev = null; Next = null; BodyA = def.BodyA; BodyB = def.BodyB; CollideConnected = def.CollideConnected; IslandFlag = false; UserData = def.UserData; Index = 0; EdgeA = new JointEdge(); EdgeA.Joint = null; EdgeA.Other = null; EdgeA.Prev = null; EdgeA.Next = null; EdgeB = new JointEdge(); EdgeB.Joint = null; EdgeB.Other = null; EdgeB.Prev = null; EdgeB.Next = null; // m_localCenterA = new Vec2(); // m_localCenterB = new Vec2(); }