We used BP_FirstPersonCharacter to implement a left-mouse drag into smooth, continuous movement and rotation for two interactive pads (“LeftPad” and “RightPad”).
High-Level GoalOn Left Mouse Button, cast a ray from the cursor into the world. If the hit component is tagged as Left or Right, compute a target location (impact point) and rotation (look direction), then drive the corresponding pad toward that target using Timeline-powered Lerp for stable, non-snappy motion.
Data Flow
Update Active Pad Timeline:
-
LeftPad Continuous Movement
Read current state with Get World Location and Get World Rotation (for the LeftPad scene component). A Timeline (looping or constantly playing) outputs an Alpha in [0,1]. Lerp Vector from CurrentLocation to TargetLocation, and Lerp Rotator from CurrentRotation to TargetRotation. Apply results using Set World Location and Rotation (target is the LeftPad scene component) for smooth chasing.
-
RightPad Continuous Movement
Mirror of the LeftPad block: read current transform, Timeline Alpha, Lerp Vector and Rotator, then Set World Location and Rotation. Which block updates this frame is decided by Section 3’s classification booleans.
-
State bookkeeping
After each SetWorldLocationAndRotation, update flags such as ActivePad (None, Left, Right), IsDragging, and cached targets for the next interpolation step.
Outcome
With this setup, a left-mouse drag smoothly drives either pad toward the cursor hit point, maintaining a sensible facing direction, while keeping code paths symmetric between Left and Right and easy to debug or extend.