Tooltips and selecting actors

A bunch of semi-related queries:

Is it possible in Panda to:

a) Have “tooltip” functionality - i.e. have a label pop up when my mouse moves over an actor (to show his name/some stats)

b) Have my mouse cursor change when my mouse moves overs an actor or other model I can click to interact with (as set by myself with a “clickable” tag)

c) Somehow highlight or otherwise indicate an actor that I am using. i.e. Make the model somehow brighter ? (If not, I guess I’d have to add some other model to it to show it’s the active actor).

a) In Astelix’s collision tutorials, you’ll find an exemple about how to click and select 3d objects.

b) Voila

c) According to your game, you can possibly use a glow filter or cartoon shader (see sample exemples)… it’s only an idea!

Hi,

a) I have clicking 3d objects already working - my question is if it is possible to have a tooltip (small label) pop up when my mouse is moved over an object (no clicking).

b)This is helpful - thx. However, question is how to detect that my cursor is over a specific object (clickable) and then change its shape. (same as (a) above)

c) That may be good. I’ll see if I can get it to work.

Thx!

It’s the same: Instead of generating events when you click → generate them when the mouse change position.

Ah, gotcha. whats the best (fastest, least resource intensive) way to detect the mouse moving?

Do it within a constantly running task in your gui class.

This is more or less what I use. (I use a CollisionHandlerQueue. If you use a CollisionHandlerEvent, then the code will look different.)

self.mx = 0
self.my = 0
self.over = None
taskMgr.add(self.guiTask)

def guiTask():
    mwn = base.mouseWatcherNode
    if mwn.hasMouse():
        mx,my = mwn.getMouse()
        if mx,my == self.mx,self.my:
            if self.over:
                self.over.onOver()
            return
        mx,my = self.mx,self.my
        over = self.getCollisions(self.mx,self.my)
        if over != self.over:
            if self.over:
                self.over.onExit()
            if over:
                over.onEnter()
        if over:
            over.onOver()

To clarify, getCollisions(x,y) is a function in my gui class that sets a picker ray to from the camera node to x,y.