ive written drag n drop logic in 2d based engines and its usually something like :
// on click
DragOffset = Mouse_World_Position - Object.Location;
// while moving in the update tick
Object.Location = Mouse_World_Position - DragOffset
ish
i tried something similar in blueprints :
// onclick
DragOffset = ConvertMouseLocationToWorldSpace() - HoveringActor.Location;
SelectedActor = HoveringActor;
// while mouse is held and update(dt)
SelectedActor.Location = ConverMouseLocationToWorldSpace() - DragOffset
this works, but the object only moves a little bit
i assume ive missed something in regards to the mouse’s world position (projection/deprojection stuff)
hi , that’s not c++, and it was just psuedo code for what i have done previously, and what ive currently got setup in blueprints
i shall check out the mouse move event, cheers
ok, i have a version working…
but due to the Isometric view & my approach to coding this, the object isnt always under my cursor
my approach was this :
find mouse location in the 3d world on the “floor” of my game. the “floor” being Vector.Z = 0
this meant that when I did my dragging, I would simply use this vector