WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rating: Thread Rating: 4 votes, 5.00 average. Display Modes
  #1  
Old 01-17-2011, 08:16 AM
new_horizon new_horizon is offline
Member
 
Join Date: Apr 2010
Posts: 43
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
Reply With Quote
  #2  
Old 01-18-2011, 11:57 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
In your last two lines you have:
Code:
viz.link(headlight1, vehicle0)
vehicle0.setPosition(0,0.625,0)
Since vehicle0 takes the position and orientation of headlight1 you won't be able to set the position of vehicle0.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


All times are GMT -7. The time now is 09:17 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC