Mouse interaction in Unity

2 posts / 0 new
Last post
vcard
vcard's picture
Mouse interaction in Unity
Undefined

Simple mouse interaction is useful but some basic interactions like point, click, grab, ... are not available in Unity out of the box.

This test shows some basic interaction and uses.

Notice that mouse icon changes accordingly:

  1. Point and click on objects to show content or open external links (you need to authorize on browsers that block pop-ups)
  2. Point and click on interface buttons to show content/open links
  3. Point/Grab objects to move them
  4. Control camera distance to Avatar with mouse wheel.  This is also an easy way to have both 3rd Person and 1st Person view.
  5. Lifting the avatar over the scene is an interesting use of the grab feature (see Lifting Avatar)

A temporary bug in Unity's current WebGL export prevents mouse image change (it did work fine in previous versions) so we had to force the change by software. That is why, until the bug is corrected, the standard pointer is seen over the mouse image.

DEMO: http://odisseia.babelx3d.net/unity3d/Mouse_interactions/index.html   (Beware! Don't let the ball fall off the scene platform!)

None of the standard Unity scripts where modified. All the functionality is achieved by additional scripts. Tutorial info and project sources will be released as soon as possible.

Enjoy the demo and imagine your own uses for mouse interaction!

vcard

Visibility: 
Public - accessible to all site users
vcard
vcard's picture
HI all,

HI all,

There is no consensual view for navigating worlds. Some users prefer the 1st Person view, others the 3rd Person view (an example discussion here).

first or 3rd person view?

They are both useful in a world or game for several reasons but implementing both controllers in a scene and switching from one to another easily is a time consuming task for newbies. Multiuser world systems like Open Sim have an intuitive feature that uses the mouse wheel to do the switch of the view. Our above demo was improved and now shows a similar feature.

The testing feature "4. Control camera distance to avatar with mouse wheel" looked initially handy but the damping effect of avatar movements did not allow a perfect switch illusion so I decided to make the switch "seeing avatar/not seeing avatar" a bit more realistic by disabling avatar rendering when the camera approaches its head and vice-versa.  

Now, despite the fact that we are using unity's ThirdPersonControl all the time and never switch controls, the illusion of changing from 1st Person to 3rd Person view and vice-versa looks quite convincing.

Enjoy,

vcard

GTranslate