PDA

View Full Version : draw outline on objects?


Vaquero
12-11-2016, 11:56 PM
Hey! I saw that there's a highlighter tool, but it depends on the user picking items by sending a ray cast. I'd like to highlight objects that get chosen by my script (randomly from a list of items), not by the user.
Is there a way using the highlighter tool or do I have to create a shader effect?

Jeff
12-13-2016, 03:53 PM
Yes, the highlighter module has an outline object that you can add models to directly:


import viz
import viztask

viz.setOption('viz.display.stencil',1)
viz.go()

environment = viz.addChild('sky_day.osgb')
soccerball = viz.addChild('soccerball.osgb',pos=[-0.5,1.8,2])
basketball = viz.addChild('basketball.osgb',pos=[0,1.8,2])
volleyball = viz.addChild('volleyball.osgb',pos=[0.5,1.8,2])
items = [soccerball,basketball,volleyball]

from tools import highlighter
outline = highlighter.Outline()

def outlineTask():

while True:

for item in items:
outline.add(item)
yield viztask.waitKeyDown(' ')
outline.remove(item)

viztask.schedule( outlineTask() )