Home > other >  Bosses for advice! Questions about Unity2D drag objects
Bosses for advice! Questions about Unity2D drag objects

Time:09-28


Next little sprout new, could you tell me how to realistic drag objects move? Drag a stick, for example, the mouse hold down one end of the stick drag and drop, on the other side would be droop due to gravity factors, hold the stick in the middle part of the drag and drop, both ends will generate the corresponding equilibrium, hit a wall, and then drag the sticks sticks also can produce small rotating with the mouse for the fulcrum, learned a few nights, all kinds of script writing, when the mouse has been found that the drag object in the center of the object,

I also tried add a mouse hold down the mouse relative to the object under the direction of the force, but will be out of the mouse object, and the oscillation amplitude is very big, is the main object or cannot judge when the mouse to click on the location, one click of the mouse, the center of the object is automatically and mouse overlap,

Also please comment, I appreciate!

CodePudding user response:

Can be implemented with hinge and simple rigid body seems to be no

CodePudding user response:

reference
can be implemented with hinge and simple rigid body seems to be no

Bosses, specific how to implement, can simply about ideas

CodePudding user response:

Hinge not achieve the effect you want when you click certainly wrote the position=mousePosition is the center of the model to follow, so you need according to the mouse to click on model to calculate the position to the position of the center of the v3 model offset=position - mousePosition then at this time of the coordinate transformation into their own coordinates when setting model position plus that cheap as for the rigid effect of rigid body itself will satisfy you
  • Related