WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 08-30-2006, 04:36 PM
Elizabeth S Elizabeth S is offline
Member
 
Join Date: Aug 2006
Posts: 11
Unhappy Models showing up

I am importing a model of a car and each of its wheels separately into my script. I have created animation paths for both the car body and its wheels. When I run the script, some of the wheels may or may not appear in the scene. Running the script another time (without changing it at all) yields different results - either it may have randomly worked this time or a different wheel(s) may not appear. Any ideas what could be wrong? I'd greatly appreciate any suggestions to clear up this frustrating problem. Thanks.
Reply With Quote
  #2  
Old 08-31-2006, 04:52 AM
k_iwan k_iwan is offline
Member
 
Join Date: May 2006
Posts: 115
Hi,

I do apologise, I'm not quite following your problem.
So, you created 5 animation paths? 1 animation path for the body and another 4 for the wheels? ... or only 2 paths? 1 for body and another one for the wheels?

Is it possible to make the wheels as children of the car, and use getchild command to spin the wheels? this way, you only need to create 1 path, for the car body. The wheels will follow wherever the car goes.

well, just an opinion.

Regards,
Iwan
Reply With Quote
  #3  
Old 08-31-2006, 12:22 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Which version of Vizard are you running? Could you provide a simple script that recreates the problem?
Reply With Quote
  #4  
Old 08-31-2006, 12:26 PM
Gladsomebeast Gladsomebeast is offline
Member
 
Join Date: Mar 2005
Location: Isla Vizta, CA
Posts: 397
Like k_iwan, I am not sure why you can not see the wheels.

As suggested, you should probably make the wheels children of the car. You can do this in a modeling program or call the vizard <VizNode>.parent() fucntion.
__________________
Paul Elliott
WorldViz LLC
Reply With Quote
  #5  
Old 08-31-2006, 01:22 PM
Elizabeth S Elizabeth S is offline
Member
 
Join Date: Aug 2006
Posts: 11
Re: Models not showing up

Thanks for all your responses.
When I initially had the wheels as children of the car body, I could not get them to spin around the right pivot point. This is the reason I import them separately into my Vizard script. Is there a way to easily fix this problem.
Also, here is a trimmed-down script that I'm running....sorry for the length.

import viz
import math

viz.go()

def playAnimations():

#Add car and its wheels
Car = viz.add('Car.obj')
Car.scale(0.305,0.305,0.305)
Car.visible(viz.OFF)
CarwheelRF = viz.add('Carwheel2.obj')
CarwheelRF.scale(0.305,0.305,0.305)
CarwheelRF.translate(-0.92,0.35,1.09)
CarwheelRF.visible(viz.OFF)
CarwheelLF = viz.add('Carwheel2.obj')
CarwheelLF.scale(0.305,0.305,0.305)
CarwheelLF.translate(-2.379,0.35,1.09)
CarwheelLF.rotate(0,-1,0,180)
CarwheelLF.visible(viz.OFF)
CarwheelRB = viz.add('Carwheel2.obj')
CarwheelRB.scale(0.305,0.305,0.305)
CarwheelRB.translate(-0.92,0.35,3.45)
CarwheelRB.visible(viz.OFF)
CarwheelLB = viz.add('Carwheel2.obj')
CarwheelLB.scale(0.305,0.305,0.305)
CarwheelLB.translate(-2.379,0.35,3.45)
CarwheelLB.rotate(0,-1,0,180)
CarwheelLB.visible(viz.OFF)

#Initialize animation paths
CarpathBody = viz.add(viz.ANIMATION_PATH)
CarpathRWF = viz.add(viz.ANIMATION_PATH)
CarpathLWF = viz.add(viz.ANIMATION_PATH)
CarpathRWB = viz.add(viz.ANIMATION_PATH)
CarpathLWB = viz.add(viz.ANIMATION_PATH)
Paths = [CarpathBody,CarpathRWF,CarpathLWF,CarpathRWB,Carpa thLWB]

#Initializing velocity and ttc arrays and using them to find distances
velocity = [10,15,20,25,30]
ttc = [2,2.25,2.5,2.75,3,3.25,3.5,3.75,4,4.25,4.5,4.75,5, 5.25,5.5,5.75,6,6.25,6.5,
6.75,7,7.25,7.5,7.75,8,8.25,8.5,8.75,9,9.25,9.5,9. 75,10]
ttc1 = 5
velocity1 = 4
distance = velocity[velocity1-1]*ttc[ttc1-1]*0.44704
distance2 = 0

#Setting positions of car and its wheels for the animation paths -
#Alternating starting and ending distances for each model in this order:
#Car body, Right wheel front, Left wheel front, Right wheel back,
#Left wheel back
Positions = [ [0,0,distance],[0,0,distance2],
[-0.92,0.35,1.09+distance],[-0.92,0.35,1.09+distance2],
[-2.379,0.35,1.09+distance],[-2.379,0.35,1.09+distance2],
[-0.92,0.35,3.45+distance], [-0.92,0.35,3.45+distance2],
[-2.379,0.35,3.45+distance],[-2.379,0.35,3.45+distance2] ]

#Add the control points to the animation path
for x in range(0,len(Paths)):
cp = viz.add(viz.CONTROL_POINT)
cp.translate(Positions[2*x])
Paths[x].add(cp,0)
cp2 = viz.add(viz.CONTROL_POINT)
cp2.translate(Positions[2*x+1])
Paths[x].add(cp2,ttc[ttc1])

#Set the wheels spinning
Carrotations = (distance - distance2)/2.011
Carfullrotations = math.floor(Carrotations)
Cardegreesrotations = Carfullrotations*360 + (Carrotations - Carfullrotations)*360
Carrotatespeed = Cardegreesrotations/ttc1
CarwheelRF.spin(1,0,0,-Carrotatespeed)
CarwheelLF.spin(1,0,0,Carrotatespeed)
CarwheelRB.spin(1,0,0,-Carrotatespeed)
CarwheelLB.spin(1,0,0,Carrotatespeed)

#Link the car and its wheels to the path; play the paths
Car.link(Paths[0])
CarwheelRF.link(Paths[1])
CarwheelLF.link(Paths[2])
CarwheelRB.link(Paths[3])
CarwheelLB.link(Paths[4])
Car.visible(viz.ON)
CarwheelRF.visible(viz.ON)
CarwheelLF.visible(viz.ON)
CarwheelRB.visible(viz.ON)
CarwheelLB.visible(viz.ON)
Paths[0].play()
Paths[1].play()
Paths[2].play()
Paths[3].play()
Paths[4].play()
Paths[0].loop(viz.LOOP)
Paths[1].loop(viz.LOOP)
Paths[2].loop(viz.LOOP)
Paths[3].loop(viz.LOOP)
Paths[4].loop(viz.LOOP)

def mykeyboard(whichKey):
#to quit the script
if whichKey == viz.KEY_ESCAPE:
print 'Esc key pressed'
viz.quit();
#to play the set of animations
elif whichKey == viz.KEY_RETURN:
playAnimations();
#otherwise do nothing
else:
print 'Incorrect key pressed'


viz.callback(viz.KEYDOWN_EVENT, mykeyboard)
Reply With Quote
  #6  
Old 08-31-2006, 01:56 PM
Gladsomebeast Gladsomebeast is offline
Member
 
Join Date: Mar 2005
Location: Isla Vizta, CA
Posts: 397
When I replace the Car.obj with logo.wrl and the Carwheel2.obj with ball.wrl things work well. This suggests that there is something going on with your models.

You can still set the parent of the seperate wheel objects in Vizard. This will solve the pivot point problem so that they will spin around their centers.
__________________
Paul Elliott
WorldViz LLC
Reply With Quote
  #7  
Old 08-31-2006, 07:49 PM
k_iwan k_iwan is offline
Member
 
Join Date: May 2006
Posts: 115
@ Elizabeth S

If you'd like, I could have a look into your model. Send them to me/post the zip file in this thread, also It would be great if you could send the objects in OBJ format.

Regards,
k_iwan
Reply With Quote
  #8  
Old 09-06-2006, 12:17 PM
Elizabeth S Elizabeth S is offline
Member
 
Join Date: Aug 2006
Posts: 11
Here are the models

Attached are my models.

Thanks!
Attached Files
File Type: zip Models.zip (551.6 KB, 1938 views)
Reply With Quote
  #9  
Old 09-06-2006, 01:49 PM
Elizabeth S Elizabeth S is offline
Member
 
Join Date: Aug 2006
Posts: 11
Got it!

So far, it seems that the problem was solved by parenting the wheels to the car. Thanks to all for the help!
Reply With Quote
  #10  
Old 09-06-2006, 07:11 PM
k_iwan k_iwan is offline
Member
 
Join Date: May 2006
Posts: 115
Talking Great!

@Elizabeth;

Nice Car! you solved the problem? Cool!
I had a look into your model, everything seems fine, no inverted normals or anything that would make your object dissapears.

Have a great day, all the best in your project!!!


Regards,
Iwan
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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


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


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