private void Start() { if (tempRot != Vector3.zero) { hasTempRotation = true; } // Initialize values Mass = mass; position = transform.position; inertiaTensor = InertiaTensor.GetInertiaTensor(this, shape, isHollow); rotation = transform.rotation; }
private void Start() { if (!PhysicsNativePlugin.hasBeenEnabled) { PhysicsNativePlugin.CreatePhysicsWorld(); PhysicsNativePlugin.hasBeenEnabled = true; } // Initialize values Mass = mass; position = transform.position; inertiaTensor = InertiaTensor.GetInertiaTensor(this, shape, isHollow); rotation = transform.rotation; element = PhysicsNativePlugin.AddParticle(mass, position.x, position.y, position.z); }
// This function gets called whenever the gameobject gets converted to an entity public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { // Calculate all initial data values var data = new Particle3DData { }; data.invMass = 1.0f / mass; data.position = transform.position; data.force = force; data.acceleration = acceleration; data.inertiaTensor = InertiaTensor.GetInertiaTensor(GetComponent <Particle3D>(), shape, isHollow); data.rotation = transform.rotation; data.angularVelocity = angularVelocity; data.angularAcceleration = angularAcceleration; // Add component to manager dstManager.AddComponentData(entity, data); }
// Start is called before the first frame update void Start() { tensor = this; }