Language:
Page Info
Engine Version:

Blueprint Actor Setup

Choose your OS:

The Blueprint Actors (MI_Sphere) arrayed within the scene can be moved during gameplay by clicking and dragging with the mouse.

MiSpheres.png

OnMouseOver.png

MovingSpheres.png

In Editor

During Gameplay: Mouse Over

During Gameplay: Dragging

Components

The Components List for the MI_Sphere Blueprint is exceedingly simple; really, it is just a single Static Mesh sphere.

MI_Sphere_Components.png

Construction Script

The Construction Script for MI_Sphere just applies a new Material.

MI_Sphere_Construction.png

Event Graph

The Event Graph for the MI_Sphere Blueprint is where most of the actual work is done. This is where the mouse over, click, and touch events are processed, as well as where the dragging behavior is established. At a high level, the network does the following:

  • Swaps out the Materials applied to the object based on mouse over events.

  • Tells the object to start following the motion of the mouse cursor during a drag operation. This movement is calculated every tick.

  • Stop following the cursor once the mouse button is released.

Click for full size

Of particular importance in the network are the following Events, which drive the mouse interaction:

  • OnBeginCursorOver - This is triggered whenever the mouse cursor moves over a specific object. In this case, the sphere Static Mesh, which is one of the Blueprint's Components.

  • OnEndCursorOver - This gets called once the cursor moves off the indicated object, which, once again, is the Static Mesh Component.

  • OnClicked - This event gets called when the player clicks the mouse on the specified object.

  • OnReleased - This event gets called when the mouse button is released from the specified object.

  • OnInputTouchBegin - This gets called on a Touch event on the specified object, which happens when a player touches the screen on a mobile device.

  • OnInputTouchEnd - This gets called when a player removes their finger from the screen after touching the specified object.