Popcorning Guinea Pig
Search Results for

    Show / Hide Table of Contents

    Class DraggableModel

    Component that makes a 3D model draggable with smooth animations. Provides lift, follow, and drop animations for drag and drop interactions.

    Inheritance
    object
    DraggableModel
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: PopcorningGuineaPig.Engine.Gameplay
    Assembly: PopcorningGuineaPig.Engine.dll
    Syntax
    public class DraggableModel

    Constructors

    | Edit this page View Source

    DraggableModel(Model, Vector3, Vector3, Vector3)

    Declaration
    public DraggableModel(Model model, Vector3 position, Vector3 rotation, Vector3 scale)
    Parameters
    Type Name Description
    Model model
    Vector3 position
    Vector3 rotation
    Vector3 scale

    Properties

    | Edit this page View Source

    DragFollowRate

    How fast the dragged model converges on the cursor, per second. High enough that the model reads as held by the cursor (~95% in 0.075s) instead of trailing behind it — drop targeting is cursor-based, so a laggy model misleads the player about where the piece will land.

    Declaration
    public float DragFollowRate { get; set; }
    Property Value
    Type Description
    float
    | Edit this page View Source

    IsAnimating

    True while a lift, drop or return-to-origin tween is still running. Lets callers wait for the model to settle — e.g. to play a landing sound on contact rather than when the move was committed.

    Declaration
    public bool IsAnimating { get; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    IsDragging

    Declaration
    public bool IsDragging { get; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    IsValidDropTarget

    Declaration
    public bool IsValidDropTarget { get; set; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    LiftHeight

    Declaration
    public float LiftHeight { get; set; }
    Property Value
    Type Description
    float
    | Edit this page View Source

    Model

    Declaration
    public Model Model { get; set; }
    Property Value
    Type Description
    Model
    | Edit this page View Source

    OriginalPosition

    Declaration
    public Vector3 OriginalPosition { get; }
    Property Value
    Type Description
    Vector3
    | Edit this page View Source

    Position

    Declaration
    public Vector3 Position { get; set; }
    Property Value
    Type Description
    Vector3
    | Edit this page View Source

    Rotation

    Declaration
    public Vector3 Rotation { get; set; }
    Property Value
    Type Description
    Vector3
    | Edit this page View Source

    Scale

    Declaration
    public Vector3 Scale { get; set; }
    Property Value
    Type Description
    Vector3
    | Edit this page View Source

    Tint

    Declaration
    public Color Tint { get; set; }
    Property Value
    Type Description
    Color

    Methods

    | Edit this page View Source

    CheckRayCollision(Ray)

    Checks if a ray intersects with this model.

    Declaration
    public RayCollision CheckRayCollision(Ray ray)
    Parameters
    Type Name Description
    Ray ray

    The ray to test

    Returns
    Type Description
    RayCollision

    Collision information

    | Edit this page View Source

    GetWorldBoundingBox()

    Gets the world space bounding box for this model.

    Declaration
    public BoundingBox GetWorldBoundingBox()
    Returns
    Type Description
    BoundingBox

    The bounding box in world coordinates

    | Edit this page View Source

    Render()

    Renders the model with current transform and any visual effects.

    Declaration
    public void Render()
    | Edit this page View Source

    ReturnToOriginalPosition()

    Returns the model to its original position with animation.

    Declaration
    public void ReturnToOriginalPosition()
    | Edit this page View Source

    StartDrag(Vector3)

    Starts dragging this model with a lift animation.

    Declaration
    public void StartDrag(Vector3 dragOffset)
    Parameters
    Type Name Description
    Vector3 dragOffset

    Offset from model center to mouse position

    | Edit this page View Source

    StopDrag(Vector3, bool)

    Stops dragging and animates the model to the target position.

    Declaration
    public void StopDrag(Vector3 targetPosition, bool updateOriginalPosition = true)
    Parameters
    Type Name Description
    Vector3 targetPosition

    Final position for the model

    bool updateOriginalPosition

    Whether to update the original position

    | Edit this page View Source

    Update(double)

    Updates the draggable model, handling animations and drag state.

    Declaration
    public void Update(double deltaTime)
    Parameters
    Type Name Description
    double deltaTime

    Time since last update in seconds

    | Edit this page View Source

    UpdateDrag(Vector3, double)

    Updates the drag position to follow the mouse with smooth interpolation.

    Declaration
    public void UpdateDrag(Vector3 mouseWorldPosition, double deltaTime = 0.016666666666666666)
    Parameters
    Type Name Description
    Vector3 mouseWorldPosition

    Current mouse position in world space

    double deltaTime

    Seconds since the last update. Smoothing is frame-rate independent, so the model tracks identically at 30, 60 and 144 fps.

    • Edit this page
    • View Source
    In this article
    Back to top © 2024 Popcorning Guinea Pig Game Engine. A custom C# game engine for indie developers.