Esempio n. 1
0
        private Vector3 VelVerletSolver(PhysObj obj, float Dt)
        {
            Vector3 newPos       = new Vector3();
            Vector3 finalVel     = new Vector3();
            Vector3 oldResForces = new Vector3();

            oldResForces = obj.ResForces;       //Froces at this frame

            newPos = obj.Position + (obj.Velocity * Dt) + (((Dt * Dt * obj.InvMass) / 2) * oldResForces);

            obj.UpdateResFor(newPos);           //Forces at next frame (access thorugh obj.ResForces)

            finalVel = obj.Velocity + ((Dt * obj.InvMass) / 2) * (oldResForces + obj.ResForces);

            return(finalVel);
        }
Esempio n. 2
0
        private Vector3 VelVerletSolver(PhysObj obj, float Dt)
        {
            Vector3 newPos       = new Vector3();
            Vector3 finalVel     = new Vector3();
            Vector3 oldResForces = new Vector3();

            oldResForces = obj.ResForces;       //Froces at this frame

            // ***---> YOUR POSITION UPDATE IMPLEMENTATION HERE! <---***
            newPos = obj.Position + (obj.Velocity * Dt) + ((Dt * Dt) * (0.5f * obj.InvMass)) * oldResForces;

            obj.UpdateResFor(newPos);           //Forces at next frame (access thorugh obj.ResForces)

            // ***---> YOUR VELOCITY UPDATE IMPLEMENTATION HERE! <---***
            finalVel = obj.Velocity + (Dt * 0.5f * obj.InvMass) * (oldResForces + obj.ResForces);

            return(finalVel);
        }
Esempio n. 3
0
        private Vector3 VelVerletSolver(PhysObj obj, float Dt)
        {
            Vector3 newPos       = new Vector3();
            Vector3 finalVel     = new Vector3();
            Vector3 oldResForces = new Vector3();

            oldResForces = obj.ResForces;       //Froces at this frame

            // ***---> YOUR POSITION UPDATE IMPLEMENTATION HERE! <---***
            //newPos = ... ;
            newPos = (obj.Position + (obj.Velocity * 1) + (1 * 1 + (2 * (1 / obj.InvMass)) * oldResForces));


            obj.UpdateResFor(newPos);           //Forces at next frame (access thorugh obj.ResForces)

            // ***---> YOUR VELOCITY UPDATE IMPLEMENTATION HERE! <---***
            // finalVel = ... ;
            finalVel = (obj.Velocity + (1 / (2 * (1 / obj.InvMass))) * (oldResForces) + obj.ResForces);

            return(finalVel);
        }
Esempio n. 4
0
        private Vector3 VelVerletSolver(PhysObj obj, float Dt)
        {
            Vector3 newPos       = new Vector3();
            Vector3 finalVel     = new Vector3();
            Vector3 oldResForces = new Vector3();

            oldResForces = obj.ResForces;   //Froces at this frame

            // ***---> YOUR POSITION UPDATE IMPLEMENTATION HERE! <---***
            ///newPos =
            newPos = -((obj.Position) + (obj.Velocity / Dt) + (Dt * 2) / (2 * obj.InvMass) * obj.ResForces);


            obj.UpdateResFor(newPos); //Forces at next frame (access thorugh obj.ResForces)

            // ***---> YOUR VELOCITY UPDATE IMPLEMENTATION HERE! <---***
            ///finalVel =
            finalVel = -(obj.Velocity) + (Dt) / (2 * obj.InvMass) * ((obj.ResForces) + (obj.ResForces + 1));

            return(finalVel);
        }
Esempio n. 5
0
        private Vector3 VelVerletSolver(PhysObj obj, float Dt)
        {
            Vector3 newPos = new Vector3();
            Vector3 finalVel = new Vector3();
            Vector3 oldResForces = new Vector3();

            oldResForces = obj.ResForces; 	//Froces at this frame

            // ***---> YOUR POSITION UPDATE IMPLEMENTATION HERE! <---***
            //newPos = ... ;
            newPos = ( obj.Position + (obj.Velocity*1) + ( 1*1 +  (2* ( 1/obj.InvMass)) * oldResForces));

            obj.UpdateResFor(newPos);		//Forces at next frame (access thorugh obj.ResForces)

            // ***---> YOUR VELOCITY UPDATE IMPLEMENTATION HERE! <---***
            // finalVel = ... ;
            finalVel = (obj.Velocity + (1 / (2 * (1 / obj.InvMass))) * (oldResForces) + obj.ResForces);

            return finalVel;
        }