Hello.
This will be an odd reply, but here goes, I’m in the middle of some R&D work right now testing an AI, and I decided to throw your question at it.
Funny enough, the reply it gave actually sounds like it could be the answer to your problem.
To make the drag and drop FSM work correctly for a 2D object on a canvas in world space render mode, you need to use the Rect Transform Screen Point to World Point in Rectangle action correctly. This action will convert the screen point of the mouse pointer to the world position of the 2D object on the canvas.
You should have the drag and drop FSM on the 2D object itself, rather than on the canvas. This is because you want the object to follow the mouse pointer, and the object is the one that needs to be moved.
Here's an example of how you can set up the FSM:
Create a new FSM on your 2D object and add the following states: Idle, Dragging, and Drop.
In the Idle state, add a Mouse Down event and transition to the Dragging state.
In the Dragging state, add the UI Get Last Pointer Data Info action to get the position of the mouse pointer.
Add the Rect Transform Screen Point to World Point in Rectangle action to convert the screen point to the world position of the object on the canvas. Use the RectTransform parameter to specify the RectTransform of the canvas.
Add the Translate action to move the object to the new position. Use the Vector parameter to specify the new position.
Add a Mouse Up event and transition to the Drop state.
In the Drop state, add any actions you want to perform when the object is dropped, and transition back to the Idle state.
Make sure you set the Interactable property of the Canvas Group component on the canvas to true, so that the canvas can receive mouse events.
By using the Rect Transform Screen Point to World Point in Rectangle action correctly, you should be able to make the object follow the mouse pointer without lagging behind.
I asked it to verify this, because it sounded right but I wasn't sure, and it said the following.
I apologize if my previous response was not helpful or if there was any misunderstanding. As an AI language model, I try my best to provide accurate and helpful answers to the best of my knowledge and capabilities based on the information provided.
To clarify, if you are trying to implement drag and drop functionality for a 2D object on a canvas in world space render mode using Playmaker, you can use the following steps:
Create a new FSM on the 2D object you want to drag and drop.
In the FSM, add a state called "Idle" and set it as the start state.
Add an event trigger for "Pointer Down" and transition to a new state called "Dragging".
In the "Dragging" state, add the following actions:
"UI Get Last Pointer Data Info" action to get the position of the mouse pointer
"Rect Transform Screen Point to World Point in Rectangle" action to convert the screen point to the world position of the object on the canvas. Specify the RectTransform parameter as the RectTransform of the canvas.
"Translate" action to move the object to the new position. Specify the Vector parameter as the converted world position.
Add an event trigger for "Pointer Up" and transition to a new state called "Dropping".
In the "Dropping" state, add any additional actions you want to perform when the object is dropped, and transition back to the "Idle" state.
Note: It's important to make sure the Canvas Group component of the canvas is set to "Interactable" and "Blocks Raycasts" to enable mouse input for the canvas.
I hope this helps! Let me know if you have any further questions or if there's anything else I can assist you with.
Anwyay... I hope this helps you or at least points you in the right direction.