Exemplo n.º 1
0
        public RigidBody(RigidBodyConstructionInfo info, RigidBody.GetTransformDelegate get, RigidBody.SetTransformDelegate set)
        {
            m_info = info;
            OnGetTransform = get;
            OnSetTransform = set;

            var biInfo = new Imports.biRigidBodyConstructionInfo();
            biInfo.m_mass = m_info.Mass;
            biInfo.m_collisionShape = m_info.CollisionShape.m_handle;
            biInfo.m_linearDamping = m_info.LinearDamping;
            biInfo.m_angularDamping = m_info.AngularDamping;
            biInfo.m_friction = m_info.Friction;
            biInfo.m_rollingFriction = m_info.RollingFriction;
            biInfo.m_restitution = m_info.Restitution;
            biInfo.m_linearSleepingThreshold = m_info.LinearSleepingThreshold;
            biInfo.m_angularSleepingThreshold = m_info.AngularSleepingThreshold;

            m_getDelegate = MotionStateGetTransform;
            m_setDelegate = MotionStateSetTransform;

            m_handle = Imports.biCreateRigidBody(ref biInfo, IntPtr.Zero, Marshal.GetFunctionPointerForDelegate(m_getDelegate), Marshal.GetFunctionPointerForDelegate(m_setDelegate));
        }
Exemplo n.º 2
0
        public RigidBody(RigidBodyConstructionInfo info, RigidBody.GetTransformDelegate get, RigidBody.SetTransformDelegate set)
        {
            m_info         = info;
            OnGetTransform = get;
            OnSetTransform = set;

            var biInfo = new Imports.biRigidBodyConstructionInfo();

            biInfo.m_mass                     = m_info.Mass;
            biInfo.m_collisionShape           = m_info.CollisionShape.m_handle;
            biInfo.m_linearDamping            = m_info.LinearDamping;
            biInfo.m_angularDamping           = m_info.AngularDamping;
            biInfo.m_friction                 = m_info.Friction;
            biInfo.m_rollingFriction          = m_info.RollingFriction;
            biInfo.m_restitution              = m_info.Restitution;
            biInfo.m_linearSleepingThreshold  = m_info.LinearSleepingThreshold;
            biInfo.m_angularSleepingThreshold = m_info.AngularSleepingThreshold;

            m_getDelegate = MotionStateGetTransform;
            m_setDelegate = MotionStateSetTransform;

            m_handle = Imports.biCreateRigidBody(ref biInfo, IntPtr.Zero, Marshal.GetFunctionPointerForDelegate(m_getDelegate), Marshal.GetFunctionPointerForDelegate(m_setDelegate));
        }