Help Smooth Move/Map

Play Now

forspinki

Legend
Legendary
Oct 23, 2006
3,431
115
190
Handan, China
Has anybody got the code for smooth move i can copy please. I've been adding a lot of things with AI without issue but it's having a hard time implementing smooth move correctly.

This is the code it added to playerobject which basically made it like a slideshow.


Code:
else
{
    // Hybrid smooth movement: frame-based with time interpolation
    int count = Frame.Count;
    int index = FrameIndex;
    
    if (Frame.Reverse) index = count - FrameIndex - 1;
    
    // Calculate base progress from frame index
    double baseProgress = (double)(index + 1) / count;
    
    // Add sub-frame interpolation for smoothness
    double frameProgress = 0;
    if (FrameInterval > 0)
    {
        double timeSinceLastFrame = CMain.Time - (NextMotion - FrameInterval);
        frameProgress = Math.Max(0, Math.Min(timeSinceLastFrame / FrameInterval, 1.0));
    }
    
    // Combine frame progress with sub-frame interpolation
    double progress = Math.Min((baseProgress - (1.0 / count)) + (frameProgress / count), 1.0);
    
    switch (Direction)
    {
        case MirDirection.Up:
            OffSetMove = new Point(0, (int)((MapControl.CellHeight * i) * (1.0 - progress)));
            break;
        case MirDirection.UpRight:
            OffSetMove = new Point((int)((-MapControl.CellWidth * i) * (1.0 - progress)), (int)((MapControl.CellHeight * i) * (1.0 - progress)));
            break;
        case MirDirection.Right:
            OffSetMove = new Point((int)((-MapControl.CellWidth * i) * (1.0 - progress)), 0);
            break;
        case MirDirection.DownRight:
            OffSetMove = new Point((int)((-MapControl.CellWidth * i) * (1.0 - progress)), (int)((-MapControl.CellHeight * i) * (1.0 - progress)));
            break;
        case MirDirection.Down:
            OffSetMove = new Point(0, (int)((-MapControl.CellHeight * i) * (1.0 - progress)));
            break;
        case MirDirection.DownLeft:
            OffSetMove = new Point((int)((MapControl.CellWidth * i) * (1.0 - progress)), (int)((-MapControl.CellHeight * i) * (1.0 - progress)));
            break;
        case MirDirection.Left:
            OffSetMove = new Point((int)((MapControl.CellWidth * i) * (1.0 - progress)), 0);
            break;
        case MirDirection.UpLeft:
            OffSetMove = new Point((int)((MapControl.CellWidth * i) * (1.0 - progress)), (int)((MapControl.CellHeight * i) * (1.0 - progress)));
            break;
    }
}

Thanks
 

Breezer

Legend
Legendary
Jul 16, 2004
3,684
845
345
Better off interpolation the actual images, I was testing it using Open Pose but I got bored.

Basically, Generate new frames between existing with Pose information.
 
Upvote 0