Forum rules - please read before posting.

Third Person Draggables

Hi, I'm trying to modify the draggable system to work with objects in 3rd person, and would appreciate any advice. I'm using direct controls, and the cursor is permanently locked/hidden in the center.

I've got a door drag working fairly well, but that only initiates when the camera is centered behind the player. I understand that the drag vector is based on the delta cursor position. Ideally I'd have the drag initiate based on the player's facing direction, similar to Context Sensitive's Hotspot Detector collider.

Is there a manual way to drag the door, like calling it from a trigger? Could I perhaps override the (hidden) cursor position to match the player's position, or have it respond to a separate camera? Or is finding a draggable workaround harder than if I just built a more custom door solution? Thank you.

Comments

  • Welcome to the community, @ryanimates.

    It's possible to manually "grab" a draggable object by calling its Grab method.

    The main issue is that - if the built-in grab conditions aren't met (i.e. wrong input or cursor position) - then the object will be automatically released.

    The way around this is to get the HeldObjectData class associated with the object, once it's been grabbed, and then update its IgnoreDragState property to ignore such checks. You may also want to tinker with IgnoreBuiltInDragInput.

    Code snippet:

    myDraggable.Grab (grabPosition);
    HeldObjectData heldObjectData = KickStarter.playerInput.GetHeldObjectData (myDraggable);
    if (heldObjectData)
    {
        heldObjectData.IgnoreDragState = false;
    }
    
  • Thanks so much, this looks like what I needed! I appreciate the time you spend helping the community, cheers

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.