#1
|
|||
|
|||
viz.link Objects
Hi All,
I am working on a virtual city scene and need to attach an emitting lighting source to a motorcycle image. I have attempted this so far by placing a tif image onto a rectangle in vizard, then creating a white filled circle of the correct diameter and then attaching a light to it - however, whenever I attempt to link all of the above together, the object moves position and will not move to the coordinates that I try to place it at in the scene. The code looks like this - if anyone can share any knowledge it would be greatly appreciated - probably a basic error to you guys! # Create headlight shape viz.startlayer(viz.POLY_FILL) viz.vertexcolor(1,1,1) Radius = 0.1 NUM_DOTS = 10000.0 for i in range(0, NUM_DOTS): angle= 360.0*(i/NUM_DOTS) x = Radius*math.sin(angle) y = Radius*math.cos(angle) # Put a vertex at each of these, but jump back to zero in between viz.vertex(0,0) viz.vertex(x,y) headlight1 = viz.endlayer() headlight1.color(1,1,1) headlight1.setPosition(0,0.7,0) # Create motorcycle with solo light # bikesize = [0.75,1.65] motorcycle0 = viz.addTexture('MC cropped v2.tif') vehicle0 = viz.addTexQuad(viz.WORLD,viz.MainScene,1) # 1m sq quad vehicle0.texture(motorcycle0) vehicle0.setScale(bikesize[0], bikesize[1],1) #Size to bike width & height vehicles[0] = vehicle0 # Note IMPORTANT saves the address of the object for later use Obj_sz[2]= 2*Radius #Add emissive light to headlight beam = viz.addLight() # Make light positional beam.position(0,0.7,0) # Make this positional light a spot light by limiting its spread beam.spread(45) beam.intensity(1) viz.link(beam, headlight1) viz.link(headlight1, vehicle0) vehicle0.setPosition(0,0.625,0) Thanks Mark |
#2
|
|||
|
|||
In your last two lines you have:
Code:
viz.link(headlight1, vehicle0) vehicle0.setPosition(0,0.625,0) |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Trouble picking text3d objects | Salvar | Vizard | 4 | 12-01-2010 03:07 PM |
Semi-circle array containing target and distractor objects | ptjt255 | Vizard | 3 | 08-04-2009 03:09 AM |
multiple objects | durf | Vizard | 1 | 04-10-2009 01:42 PM |
Lightwave objects rotation problem | hosier | Vizard | 6 | 02-13-2009 12:04 PM |
Could not find plugin to load objects... | halley | Vizard | 1 | 05-30-2006 11:01 AM |