예제 #1
0
		public void GravityForce_IfTheParticleHasInfiniteMass_TheForceGeneratorWillNotAddTheForceToTheParticle()
		{
			var mockParticle = GetMockParticle(true);
			var forceGenerator = new GravityForceGenerator(TestGravity);

			forceGenerator.UpdateForce(mockParticle.Object, TestDuration);

			mockParticle.VerifyAll();
		}
예제 #2
0
        public void GravityForce_IfTheParticleHasInfiniteMass_TheForceGeneratorWillNotAddTheForceToTheParticle()
        {
            var mockParticle   = GetMockParticle(true);
            var forceGenerator = new GravityForceGenerator(TestGravity);

            forceGenerator.UpdateForce(mockParticle.Object, TestDuration);

            mockParticle.VerifyAll();
        }
예제 #3
0
		public void GravityForce_IfTheParticleHasFiniteMass_TheForceGeneratorWillAddTheGravityForceToTheParticle()
		{
			var mockParticle = GetMockParticle(false);
			mockParticle.Setup(p => p.Mass).Returns(TestMass);
			mockParticle.Setup(p => p.AddForce(GravityForce));

			var forceGenerator = new GravityForceGenerator(TestGravity);
			forceGenerator.UpdateForce(mockParticle.Object, 1.0);
			mockParticle.VerifyAll();
		}
예제 #4
0
        public void GravityForce_IfTheParticleHasFiniteMass_TheForceGeneratorWillAddTheGravityForceToTheParticle()
        {
            var mockParticle = GetMockParticle(false);

            mockParticle.Setup(p => p.Mass).Returns(TestMass);
            mockParticle.Setup(p => p.AddForce(GravityForce));

            var forceGenerator = new GravityForceGenerator(TestGravity);

            forceGenerator.UpdateForce(mockParticle.Object, 1.0);
            mockParticle.VerifyAll();
        }
예제 #5
0
        public ProjectileSimulation Simulate()
        {
            ProjectileSimulation simulation = new ProjectileSimulation();

            simulation.InitialVelocity = projectile.velocity;
            var    positionWithTime = new List <Snapshot>();
            double startTime        = 0f;
            //double endtime = 10f;
            double tick           = Utils.GetTickFromFPS(20);
            var    forceGenerator = new GravityForceGenerator();

            while (projectile.position.y >= 0)
            {
                var snapshot = new Snapshot(projectile.position, startTime);
                positionWithTime.Add(snapshot);
                //forceGenerator.applyForce(ref projectile,projectile.mass);
                projectile.netForce = new Vector(0, 0, 0);
                projectile.Integrate(tick);
                startTime += tick;
            }
            simulation.Snapshots = positionWithTime;
            return(simulation);
        }
 // Start is called before the first frame update
 void Start()
 {
     gravityForceGenerator = new GravityForceGenerator(true, mPhysicsObjects);
 }