PDA

View Full Version : draw outline on objects?


Vaquero
12-12-2016, 12:56 AM
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, 04: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() )