Home Search

DriveWorks Pro 24
Drag

Send Feedback

Drag

The Drag entity allows a model to be moved and positioned within a scene using mouse or touch input.

Applying the drag entity to a node enables it to be dragged within a scene.

Please note

For a model to be dragged within a scene a surface must exist to allow it to be positioned.

When a model is dragged a (hidden) ray is cast that detects a surface so a position in the 3D space can be determined.

How drag works

The drag effect starts when the object comes into contact with other geometry in the scene.

If the object is positioned away from other geometry, the drag will only begin when the object hovers over other geometry.

Any transform position co-ordinates, applied to the object, will be overridden once the drag starts.

Drag uses the default camera or any other camera entities added to the scene.

Nodes can be dragged between cameras within the same scene.

The object will be dragged about its origin regardless of the selection point.

When the object is selected a ray is cast (based on the mouse location and node origin) into the scene.

The position of the node is then set to be the closest part of the drag surface that is hit by the ray.

  1. Camera
  2. Mouse Ray
  3. Click Position
  4. Model
  5. Drag Ray
  6. Model Origin
  7. Drag Surface
  8. Model's New Position

Drag Methods

Dragging a model when the 3D document is viewed in a 3D Preview control is done by the following methods:

Primary mouse button click and move the item (on devices using a mouse)Touch and move the item with a single finger (on touch enabled devices)

The primary mouse button is set in Windows system settings.

By default this is usually set to the Left button.

When set to Right the right button will become the primary mouse button.

Special Variables

The following special variables are populated with information from this entity:

  • Current Macro Caller

    Populated with the address of the Drag Entity's node (the node the Drag Entity has been applied to) during both the On Start Macro Name and the On End Macro Name.

    The address does not contain the 3D document name.

    For example:

    Root\Object

  • Touchpoint Hit Node

    This is populated when the On Start Macro Name is set.

    Populated with the address of the node that was clicked.

    The address does not contain the 3D document name.

    For example:

    Root\Object\ChildNode

  • Touchpoint Hit Position

    This is populated when the On Start Macro Name is set.

    The values sent to the DWTouchPointHitPosition are the XYZ values (absolute and vector) of the point in a 3D Preview control where the Drag Entity was clicked.

    For example:

    93.69|168.65|500|0|0|1

Priority Order

There is a priority order for entities that can affect the position of a node.

For example, if a node has an enabled Animate Translation entity and an enabled Drag entity, the Drag entity will not function until the Animate Translation entity has been disabled.

The priority order is as follows:

  1. Animate Translation
  2. Smooth Translate
  3. Drag
  4. Pan

When using multiple entities that affect the position of the same node, ensure there is a mechanism for disabling position affecting entities before expecting another entity to function.

Information Panel

With the model node selected and the Drag entity added to the node, the following will be displayed in the Information Panel:

Enabled

Allows the Drag entity to be enabled or disabled.

Disabling the Drag entity will disable the node from being moved in the scene.

A rule can be built for the enabled parameter by double clicking the Drag Enabled property from the Parameter Panel.

Drag Surface

A specified surface can be set that allows the item to be dragged onto.

When a Drag Surface is not set the drag surface default to the Root node.

Enter the node address of the geometry that is to be the Drag Surface.

For example:

Root\Ground Plane\Ground Plane\DragSurface

Right click (secondary mouse button) on the node required to be the Drag Surface in the Feature Panel and select Copy Address.

Paste this directly into the Drag Surface parameter.

A rule can be built for the Drag Surface parameter by double clicking the Drag Surface property from the Parameter Panel.

On Start - Macro Name

A macro can run once the node with the Drag Entity is selected in the 3D Preview control.

Enter the name of the macro to run on start, for example:

ApplyOutlineGlowToDragSurface

A rule can be built for the On Start Macro Name parameter by double clicking the On Start Macro Name property from the Parameter Panel.

On Start - Macro Argument

The value or result of a rule, placed in the Macro Argument property, is passed into the special variable DWCurrentMacroArgument (see Info: Special Variables).

Using the Macro Argument property allows the same macro to be used, but with differing outcomes depending on when it is run.

Enter the argument to send to the DWCurrentMacroArgument special variable for example:

"GlowEnabled"

On End - Macro Name

A macro can run once the node with the Drag Entity is released in the 3D Preview control.

Enter the name of the macro to run on end, for example:

TurnOutlineGlowOff

A rule can be built for the On End Macro Name parameter by double clicking the On End Macro Name property from the Parameter Panel.

On End - Macro Argument

The value or result of a rule, placed in the Macro Argument property, is passed into the special variable DWCurrentMacroArgument (see Info: Special Variables).

Using the Macro Argument property allows the same macro to be used, but with differing outcomes depending on when it is run.

Enter the argument to send to the DWCurrentMacroArgument special variable for example:

"GlowDisabled"

Parameter Panel

With the model node selected and the Drag entity added to that node, the following will be displayed in the Parameter Panel:

Double click each parameter to build a rule.

  • Drag Enabled

    Is required to result in True or False

  • Drag Surface

    Is required to result in the node address of the node that will act as the surface the item can be dragged onto.

  • On Start Macro Name

    Is required to result in the name of a macro.

  • On Start Macro Argument

    Is required to result in a value to pass to the DWCurrentMacroArgument special variable.

  • On End Macro Name

    Is required to result in the name of a macro.

  • On End Macro Argument

    Is required to result in a value to pass to the DWCurrentMacroArgument special variable.

See Also

How To: Set Up The Drag Entity