I am trying to make a game where the player is the mouse, and I’m using a mouse joint with a constantly updating target, which is the current mouse position. But the player sprite is WAY offset, and nothing i do fixes it.
Can you post the events? It could be as simple as using Y instead of X.
Weird. On my phone I get the same offset. It swings like a rope joint.
This example seems to work. Maybe it uses an older version of an action.
It seems to work for me if I add the object with an action even if it’s just in a at the beginning but it has an offset if I create it in the editor.
What do you mean?
Also, maybe i should explain why im using a mouse joint for this.
I want the player to follow the mouse, but me to still be able to track its direction of movement.
Wait, hang on, i think i got it (as in why it broke)
My theory:
it is taking into count the original offset between the 2 positions, if the mouse is offset when the joint is made, it will attempt to stay offset.
Edit: yeah, so if i move it to the cursor first, then make the joint, it works as intended
That’s weird. The joint description does say
Warning
The initial target position (at the moment of creating the joint) is also used as the object anchor point, so make sure to set it!
The cursor returns 0,0 until the cursor is moved for the first time.
So, is this a bug or a feature?
No idea.
I ditched using the joint, and went with a 3d model I whipped up