Bind shader affected Object to cursor?

  • #1, by NinjapieTuesday, 10. May 2016, 16:00 4 years ago
    Afternoon all, hoping someone can help me. Really new to all this and whilst i vaguely understand bits and pieces of lua script im struggling.

    I've created a scene where the cursor is a magnifying glass, with the 'Glass' part transparent, and when the cursor enters an object area it 'reveals' a clue using the mouse over action parts. Easy as pie, but then i had the idea of making the magnifying glass a sort of hand held electronic scanner, using the Shader tv effect on the transparent screen. However, you cant use the shader on a cursor (as far as im aware) and even if you could it would affect the whole cursor image rather than just the screen part.

    Next idea was to create a nearly transparent object on the scene, apply the shader effect to that and bind its position to the position of the cursor..so that it looks like the scene object is the 'screen' part of the cursor and you can look though it to the scene underneath.

    Rooting through the forums i found this thread (Character's Shadow) which nearly does the same thing, but it binds character to character (i think).

    Anyone got any ideas?

    Newbie

    7 Posts


  • #2, by sebastianTuesday, 10. May 2016, 16:39 4 years ago
    When the shader affect can be applied to an animation i would guess it would work when you move the an object animation to cursor position. But i never tested it

    Thread Captain

    2334 Posts

  • #3, by afrlmeTuesday, 10. May 2016, 17:02 4 years ago
    I never tested applying it to an object animation either. You will need to add an offset value from the cursor position to make sure it is aligned correctly.

    You don't need a loop, for updating the positon, you can use the mouse event handler with mouse move event I think.

    Imperator

    6804 Posts

  • #4, by NinjapieTuesday, 10. May 2016, 20:22 4 years ago
    thanks, ill do some reading as event handlers are something im not really up on, but just wanted to clarify in case it makes a difference...

    Shouldn't it be irrelevant that there's an animation involved? The cursor image, both active and inactive, will be a single frame. The shader effect will be applied to a Scene object's image, so i just need to make that object stick to the cursor hotspot rather than its active or inactive animations, right?

    The cursor position is calculated from its 'Hotspot' centre, and the object image (with the shader applied) has its position calculated from the top left (right?) so i just need to make them tally up?

    I work better visually, so maybe this will help?

    Newbie

    7 Posts

  • #5, by NinjapieTuesday, 10. May 2016, 20:25 4 years ago
    Or am i missing the point, and you're saying the shader effect ive applied to the scene object image wont move?
    I know its not really applied to the image, but to the object itself, but the image moves with the object, so i cant see why the shader effect wouldnt go with it too, unless its position is just calculated once at the beggining of the scene, using the object as reference and its not actually linked to the object?

    Oh for a manual or better education... (just kidding Visionaire team, i know you work your tushes off.)

    Newbie

    7 Posts

  • #6, by afrlmeTuesday, 10. May 2016, 21:33 4 years ago
    Personally I don't know as I've never tested using a shader effect on a moving object, or whether it would work on an animation or a static image assigned to a scene object. I assume it would work on a static image, but the only way to move those is to use the object offset action parts or Lua script. Offset however is a lot more complicated than simply telling something to move to absolute coordinates as you have to get the objects position then calculate the x,y offset to move it to another position in the scene - basically it involves math & I hate math. grin

    In regards to your diagram... very nice. Yes you are correct that object / animation image positions are based on their top left most pixel, whereas the cursor position is based on where you placed the interaction point. So if you used an animation & positioned it to the magnifying mouse cursor then the top left pixel of the animation would be in the center of the magnifying glass.

    Can you not just create an animated version of the tv static? Shouldn't be that hard to do. I'm sure there are online websites that could generate it for you. Even a website that generates noise images for websites should do.

    Imperator

    6804 Posts

  • #7, by NinjapieWednesday, 11. May 2016, 10:24 4 years ago
    Yes, that would be the easy way out. heh.
    I did think of that, but thought id see if it was possible anyhow for future reference. If i went the magnifying glass route for example, i couldnt animate the glass distorting the image underneath. Just trying to add more weapons to the arsenal. smile

    Anyhow, thanks for replying, really appreciated. Looking through these forums you should probably receive some kind of knighthood for the amount of help you dish out, and at the very least youve made me get off my lazy ass and read up on event handlers. wink

    Newbie

    7 Posts

  • #8, by afrlmeWednesday, 11. May 2016, 12:04 4 years ago
    haha! If only... grin

    It probably would be possible, just without me testing it out myself I can't guarantee that it will work. I'm also trying not to hand out plug & play-like working solutions as I have done in the past, as otherwise, you lot won't end up learning how to figure things out yourselves. wink

    Imperator

    6804 Posts

Write post