예제 #1
0
        FloatingAttachPoint NewFloatingAttachPoint(Hand hand)
        {
            FloatingAttachPoint floatingAttachPoint = new FloatingAttachPoint();

            floatingAttachPoint.Position = GetAttachPoint3d(hand);
            return(floatingAttachPoint);
        }
예제 #2
0
        Vector GetFloatingAttachPoint3d(Vector attachPoint3D, FloatingAttachPoint floatingAttachPoint)
        {
            Vector forceVector = GetSpringForceVector(attachPoint3D, floatingAttachPoint.Position);

            DateTime now       = DateTime.Now;
            TimeSpan deltaTime = now - floatingAttachPoint.SnapshotTime;

            Vector currentPosition = floatingAttachPoint.Position.GetCurrentPosition(forceVector, floatingAttachPoint.Velocity, deltaTime);
            Vector finalVelocity   = floatingAttachPoint.Velocity.GetFinalVelocity(forceVector, deltaTime) * 0.965f;

            floatingAttachPoint.Velocity     = finalVelocity;
            floatingAttachPoint.Position     = currentPosition;
            floatingAttachPoint.SnapshotTime = now;
            return(currentPosition);
        }