HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: [Resolved] Interactive Object MouseOver highlight  (Read 2492 times)

LuisTorralva

  • General Accounts
  • *
  • Posts: 15
    • View Profile
[Resolved] Interactive Object MouseOver highlight
« on: Apr 02, 11, 03:31:49 PM »

Was wondering if there is a reference on HJ on an object mouseover highlighting,
so far i havent come across one yet, so i am asking if someone had or done this.

when mouse over an intractive object to highlight the object. ie: NPC, other player, mob etc...

is this something that could be  achieved via HSL?

thanks
« Last Edit: Nov 02, 12, 08:30:17 PM by HE-Cooper »
Logged

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: Interactive Object MouseOver highlight
« Reply #1 on: Apr 02, 11, 05:19:08 PM »

I am not sure about how to do it with characters, but for static models that are just GR2Instances, they have two lighting settings: AmbientColor and DiffuseColor.  We set those differently when the mouse is over an object or not by using the Enter/Leave events handled in the shared function InputMouseEvent of a class glommed onto the objects.

Setting #1,1,1,1 will have them appear in their natural state.  You can use numbers higher than 1 to super-saturate the color and make it especially bright.  You can also use the alpha to adjust transparency.

But the really interesting things come in when you use the parametric settings for the colors.  We used a timeline that goes up and down between a more and less intense color when the cursor enters the object.  The effect is that when hovering over, it appears to "pulse".

The other parametrics are nifty, too: gaussian is constantly changing random values around a standard distribution, while perlin noise provides a random walk effect that can look sort of psychodelic when used with color.

The caveat is that these colors set how it responds to light, so the effect will be relative to the light that is on it.  Ours were in a relatively dark area, so that is why we used higher values than 1 so it would still be visible; they almost seem to glow.
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

HE-JAY

  • HeroEngine
  • *****
  • Posts: 122
    • View Profile
Re: Interactive Object MouseOver highlight
« Reply #2 on: Apr 04, 11, 05:45:27 PM »

As Scott mentioned (thanks, Scott!), the method HJ uses to highlight characters and other objects is to modify the AmbientColor and DiffuseColor properties of your HBNode in response to a mouse event.

This entails the following:
  • Create a mouse input handler in a class that exists on your character node (usually done through glomming onto the HBNode on the client)
  • Make sure the node's MouseTargetable property is set to True and the MouseTransparency property is set to False.
  • In response to the Enter/Leave mouse events, modify the ambient and diffuse color of the character via the AmbientColor and DiffuseColor properties. This can be as simple as manually setting the values in response to each event, or as complex as creating (as Scott mentioned) a pulsing effect and remembering the old values between states.

A very basic example of such functionality in a class glommed onto your node might be:
Code: [Select]
shared function InputMouseEvent(args references Class _MouseEvent)
  targetNode as NodeRef of Class HBNode = args.MouseTarget
  if targetNode <> None
    when args.MouseEventType
      is Enter
        targetNode["DiffuseColor"] = "#3.0,2.0,2.0,1.0"
        targetNode["AmbientColor"] = "#3.0,2.0,2.0,1.0"
      .
      is Leave
        targetNode["DiffuseColor"] = "#1.0,1.0,1.0,1.0"
        targetNode["AmbientColor"] = "#1.0,1.0,1.0,1.0"
      .
    .
  .
.

Logged

LuisTorralva

  • General Accounts
  • *
  • Posts: 15
    • View Profile
Re: Interactive Object MouseOver highlight
« Reply #3 on: Apr 04, 11, 07:19:13 PM »

thanks guys,

will give it a try.
Logged