About Store Forum Documentation Contact
Donations:
392$/mo



Post Reply 
[RESOLVED] SetHighlight(colorvalue) in drawPrepare()
Author Message
aceio76 Offline
Silver Supporter

Post: #1
[RESOLVED] SetHighlight(colorvalue) in drawPrepare()
Given the following snippet for a custom game object:
Code:
UInt ObjInteractableBase::drawPrepare()
{
   if(ObjHover==this) SetHighlight(Color(33,33,33,0));
   else SetHighlight();
   return 0;
}
When I set a number of Objects in the WE with the custom obj type, there is always one that when the mouse hovers over it, it highlights all other objects (mostly) instead of itself. If I have 3 objects, 2 highlights properly, if I have 5, 4 highlights properly, and so on. I can't pinpoint easily but my suspicion is either the first or the last of the objects is always broken.

Is this a bug? I don't have control (easily) over what gets highlighted by the SetHighlight(color) in the RM_PREPARE mode of the renderer.

www.thinkplaystudios.com
(This post was last modified: 10-05-2011 06:16 AM by aceio76.)
09-26-2011 03:05 AM
Visit this user's website Find all posts by this user Quote this message in a reply
alkirah Offline
Member

Post: #2
RE: SetHighlight(colorvalue) in drawPrepare()
WOW was about to post the exact same message.

I have 12 npc added as OBJ_CHR, in a memx container.

Physhit gives uniques id for each.

When I select 1st, 1st + entire world is highlighted, all 11 others working properly.

So npc[0]=highlight entire world terrain+mesh behing cursor, all others highlight only mesh behind cursor.

using this code in my chr::drawprepare
if (selObj==this && selHighlight)
SetHighlight(Color(90,90,90));
09-26-2011 06:33 AM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #3
RE: SetHighlight(colorvalue) in drawPrepare()
Bad code.

Code:
SetHighlight(color);
UInt modes = __super::drawPrepare();

SetHighlight();
return modes;
09-26-2011 07:20 AM
Find all posts by this user Quote this message in a reply
alkirah Offline
Member

Post: #4
RE: SetHighlight(colorvalue) in drawPrepare()
exact same problem, I updated the engine with autoupdate and problem still there smile

if (selObj==this && selHighlight)
SetHighlight(Color(90,90,90));
else
SetHighlight(Color(0,0,0));

UInt modes = __super::drawPrepare();
return modes;
(This post was last modified: 09-26-2011 02:24 PM by alkirah.)
09-26-2011 01:23 PM
Find all posts by this user Quote this message in a reply
aceio76 Offline
Silver Supporter

Post: #5
RE: SetHighlight(colorvalue) in drawPrepare()
(09-26-2011 07:20 AM)Driklyn Wrote:  Bad code.

Code:
SetHighlight(color);
UInt modes = __super::drawPrepare();

SetHighlight();
return modes;

I had tried similar to your code snippet but with it, it will not highlight the object. Also, the object don't always light if my camera is too close and on certain angles (it will light up everything else else), which tells me it is related to the lighting.

www.thinkplaystudios.com
(This post was last modified: 09-26-2011 03:59 PM by aceio76.)
09-26-2011 03:38 PM
Visit this user's website Find all posts by this user Quote this message in a reply
alkirah Offline
Member

Post: #6
RE: SetHighlight(colorvalue) in drawPrepare()
his code don't have the if/else structure you have.

SetHighlight(); will revert back highlight color to 0,0,0 and that's why it won't light.

so basicly you tell highlight using a color, then use no color. smile

that is what he meant, but on my code it's not working anyway

UInt ObjInteractableBase::drawPrepare()
{
if(ObjHover==this) SetHighlight(Color(33,33,33,0));
else SetHighlight();
UInt modes = __super::drawPrepare();
return modes;
}
09-26-2011 03:44 PM
Find all posts by this user Quote this message in a reply
aceio76 Offline
Silver Supporter

Post: #7
RE: SetHighlight(colorvalue) in drawPrepare()
It will also on what obj you base your object on? Initially, I based on game::obj which will return 0. I tried basing on kinematics and called __super::drawPrepare() similar to his example, but I still get the lighting error.
Some examples are in order.
This image shows the left barrel highlighted:
[Image: hiliteissue01.jpg]

But if I come closer while keeping the barrel highlighted (mouse hover over it):

[Image: hiliteissue02.jpg]

www.thinkplaystudios.com
(This post was last modified: 09-26-2011 09:10 PM by aceio76.)
09-26-2011 04:09 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #8
RE: SetHighlight(colorvalue) in drawPrepare()
SetHighlight effects the rendering of all meshes, so you need to enable it, draw your mesh, then disable it before the function ends:

Code:
if (ObjHover == this) SetHighlight(color);
UInt modes = __super::drawPrepare();

if (ObjHover == this) SetHighlight();
return modes;
09-26-2011 08:40 PM
Find all posts by this user Quote this message in a reply
alkirah Offline
Member

Post: #9
RE: SetHighlight(colorvalue) in drawPrepare()
Thanks so much! working properly now
09-26-2011 08:47 PM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #10
RE: SetHighlight(colorvalue) in drawPrepare()
Cool. Glad to hear.
09-26-2011 08:49 PM
Find all posts by this user Quote this message in a reply
aceio76 Offline
Silver Supporter

Post: #11
RE: SetHighlight(colorvalue) in drawPrepare()
Did you guys extend the Game::Obj and overridden the drawPrepare() method? I am still getting the over lighting when I get too close to the target object.

www.thinkplaystudios.com
09-27-2011 03:02 AM
Visit this user's website Find all posts by this user Quote this message in a reply
alkirah Offline
Member

Post: #12
RE: SetHighlight(colorvalue) in drawPrepare()
for me it's the Game::Chr but I think Chr extends ::obj.

Yes I've overridden the drawPrepare button, basicly, you set highlight, call super::drawPrepare, then remove highlight and return that modes value.

That worked for me
09-27-2011 05:17 AM
Find all posts by this user Quote this message in a reply
Post Reply