//============================== Unity Events ============================== void Awake() { ParallelPhysicsController3D pSettings = FindObjectOfType <ParallelPhysicsController3D>(); if (pSettings == null) { return; } pSettings.InitIfNecessary(); parallelFixedUpdates = GetComponents <IParallelFixedUpdate>(); parallelCollisions = GetComponents <IParallelCollision3D>(); parallelTriggers = GetComponents <IParallelTrigger3D>(); pTransform.ImportFromUnity(); colliders = GetComponentsInChildren <ParallelCollider3D>(); _body3D = Parallel3D.AddBody( (int)bodyType, pTransform.position, pTransform.rotation, linearDamping, angularDamping, gravityScale, fixedRotationX, fixedRotationY, fixedRotationZ, this); _bodyID = _body3D.BodyID; foreach (ParallelCollider3D collider in colliders) { PShape3D shape = collider.CreateShape(gameObject); if (shape == null) { Debug.LogError("Failed to create collider shape"); continue; } PFixture3D fixture = Parallel3D.AddFixture(_body3D, shape, (Fix64)1); collider.ReceiveFixture(fixture); } if (_overideMassData) { //Parallel3D.UpdateMassData(_body3D, _mass, _centerOfMass); if (_centerOfMass != null) { Fix64Vec3 com = _centerOfMass; //Debug.Log(com); Parallel3D.UpdateMassData(_body3D, _mass, com); } else { Parallel3D.UpdateMass(_body3D, _mass); } } }