Пример #1
0
        public static void ApplyImpulse(int rigidbodyIndex,
                                        float4 impulse,
                                        float4 point,
                                        NativeArray <BurstRigidbody> rigidbodies,
                                        NativeArray <float4> linearDeltas,
                                        NativeArray <float4> angularDeltas,
                                        BurstAffineTransform transform)
        {
            float4 impulseWS = transform.TransformVector(impulse);
            float4 r         = transform.TransformPoint(point) - rigidbodies[rigidbodyIndex].com;

            linearDeltas[rigidbodyIndex]  += rigidbodies[rigidbodyIndex].inverseMass * impulseWS;
            angularDeltas[rigidbodyIndex] += math.mul(rigidbodies[rigidbodyIndex].inverseInertiaTensor, new float4(math.cross(r.xyz, impulseWS.xyz), 0));
        }