Forum rules - please read before posting.

[Feat.Request] Draggable Drag Mode: Rotate along axis/towards cursor/touch point (screen space).

edited August 2019 in Engine development

Hinges work pretty well once you understand how to set them up (I believe the setup is a bit...unfriendly tho: should be clearer where is the pivot, what the spherical collider is and why it is needed - missing in the physics sample scene)) , unless you have a clock/door handles, volume knobs, any circular draggable with the plane facing almost straight to the camera.

You'd expect (mobile) that dragging the draggable in circle moves it toward the pressed point, but it rather moves it in some erratic way, which I believe is counter-intuitive.

Desired "pinned" rotating draggable setup:

1 - check one or more Constrains on the rigidbody
2 - Set the pinned object in position straight away, no need for tracks. The pivot of the rotating object is the pivot of the rotation, already in place (no need for misplaced/weirdly rotated objects in the scene)
3 - set the Drag Mode to Facing Cursor
4 - the rotating object tries to move the dragged position toward the cursor in the best possible way

The draggable will always try to face the cursor in screen space, then flattens the local angle coords according to the Rigidbody constraints.

Comments

  • Rigidbody constraints are in world-space, not local. I shall see if it is possible to add a "move to cursor" option, however.

  • Rigidbody constraints are in world-space, not local. I shall see if it is possible to add a "move to cursor" option, however.

    Yup, I've just double checked as well. Actually, I mostly use the positionY constraint to avoid object to fall off.
    https://docs.unity3d.com/ScriptReference/Rigidbody-constraints.html

    Yet, the rotation constraints are in local space, so no need do reinvent the wheel (maybe) :)

    I managed to solve most of the issues, but setting a hour still doesn't feel too great (especially on mobile), since it makes a rotatory movement feel like an up/down motion.

    See video on the snapping thread for reference.

    having a 1:1 draggable position mode in screen space would be useful as well (to allow for snapping to positions(axis space) instead of rotations - I'm going to implement a snapper for positions as well :) )

  • To update: both a "screen space" option and "auto-snapping" feature will be part of the next AC update.

    For the former, tracks will have a "Movement calculation" option that, when set to "Cursor Position", will cause attached objects to move according to the cursor's position in screen space. This won't always be the best choice, e.g. when things are viewed at strong angles, but in the case of e.g. a clock that's facing the camera, it's much more intuitive.

    For the latter, track Inspectors will also have a section to define various snap points that attached object to move towards when inside a defined "catchment area". These will show up in the Scene window on top of the white "track gizmo" in a colour of your choosing. The new OnDraggableSnap event will also be called once a draggable object reaches such a point.

  • Sounds great!

    I was already reinventing the wheel by building a parallel drag-swipe-snap system, but knowing that it's going to be released natively sometime soon, is going to push the subsystem creation a bit down in priority in my tasks :)
    Thanks for that :)

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.