Forum rules - please read before posting.

Moveable using player's character rather than mouse pointer

Hello Chris,
Is there a way to make the Draggable feature working with a character rather than the mouse pointer?

For example, i have a 3d character that moves around a 3d environment, when the player presses and holds a given key nearby a moveable object, i would expect the player to grab and drag the object around the level, depending on the moveable constrain's track.

I mean actuall dragging, like it would happen with a heavy crate, as seen in the example below:

Or is it better to script such feature from scratch?

Thanks for your help as usual!

Comments

  • edited May 2021

    The provided Drag system is written with mouse conrol in mind, so it's probably best to rely on something entirely custom-made - at least depending on how complex you want the system to be.

    However, it is possible to move a Drag object through a custom script by applying a 3D force to it. This can be done by calling its ApplyDragForce function from FixedUpdate, i.e.:

    myDragObject.ApplyDragObject (force, Vector2.zero, 50f);
    

    Don't worry about the 2nd and 3rd parameters, but you'll need to ensure that any Track it may be attached to has its Movement input set to Drag Vector.

    The "force" parameter would then be a Vector3 that represents the directional force, such as the change in a character's hand position from the previous frame.

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.