WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rating: Thread Rating: 3 votes, 5.00 average. Display Modes
  #1  
Old 11-26-2007, 12:45 PM
Elittdogg Elittdogg is offline
Member
 
Join Date: Aug 2007
Posts: 77
The problem with this is that it makes the transitions very very very quickly if I put decimals in the list "movetime."

movetime = [.05, .25, .75, 1, 2]
sequences = []
for time in movetime:
MoveRoom = vizact.sequence(vizact.move(0,0,(0.12/time),time), vizact.move(0,0,(-0.12/time),time), (30/time))
sequences.append(MoveRoom)
sequences.append( vizact.call( WriteFlag ) )
MovingRoom = vizact.sequence(sequences, 1)

If I make the code:
MoveRoom = vizact.sequence(vizact.move(0,0,(0.5/time),time), vizact.move(0,0,(-0.5/time),time), (30/time))

and I make movetime [1, 2, 3, 4, etc] then it'll move .5 m/s for 1 second and then .25 m/s for 2 seconds...etc....all of the movements will result in moving .5 meters for a total of 1 minute. But when I have the above (if I want it to move .12 meters in .05 seconds or .25 seconds, etc.) it moves really fast for a second and then moves on to the next number in the list. It doesn't perform what I want it to and it doesn't do it for 1 minute either. Is there some problem with decimals? Am I making a wrong conversion? I tried changing the end (instead of 30/time to 600/time but that didn't change anything--if anything it made it transition faster. Am I missing something?
Reply With Quote
  #2  
Old 11-26-2007, 12:52 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Then don't put decimals in your movetime list. Keep in mind that dividing two integers in Python will yield another integer that is the floor of the division. Example:
Code:
print 1 / 2 #prints 0
print 1 / 2.0 #prints 0.5
So you will need to either use floating point values in your movetime list or use floating point values for your distance.
Reply With Quote
  #3  
Old 11-26-2007, 12:58 PM
Elittdogg Elittdogg is offline
Member
 
Join Date: Aug 2007
Posts: 77
what's a floating point value?

Like if I want it to move .12 meters in .5 seconds how would I code that?

I'm not familiar with floating point values.

Even if I make it 1/20.0 instead of .05 it doesn't work. It still moves really fast and transitions WAY before a minute has passed.

Last edited by Elittdogg; 11-26-2007 at 01:01 PM.
Reply With Quote
  #4  
Old 11-26-2007, 01:04 PM
Elittdogg Elittdogg is offline
Member
 
Join Date: Aug 2007
Posts: 77
Also, even if I make it 1/2.0 it goes really fast and doesn't last one minute. Maybe I'm just confusing myself?
Reply With Quote
  #5  
Old 11-26-2007, 01:06 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
In most programming languages, non-fractional numbers are referred to as integers and fractional numbers are referred to as floats or floating point values. For example the following are integers:
Code:
1
2
3
4
and the following are floats
Code:
1.0
2.1
3.89
4.43509876
Reply With Quote
  #6  
Old 11-26-2007, 01:10 PM
Elittdogg Elittdogg is offline
Member
 
Join Date: Aug 2007
Posts: 77
So 0.5 should be a floating point if I'm understanding correctly. And my desired distance is already "0.12" which would also be a floating point. Yet it is still not working for me. Am I missing something?
Reply With Quote
  #7  
Old 11-26-2007, 01:42 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
What exactly is not working? According to your example code, the longest move action will last 2 seconds. None of the values in the movetime list are specifying anything close to a minute.
Reply With Quote
  #8  
Old 11-27-2007, 01:11 PM
Elittdogg Elittdogg is offline
Member
 
Join Date: Aug 2007
Posts: 77
Ok. So what I originally had was:

movetime = [1,2,3,4,5,6]
sequences = []
for time in movetime:
MoveRoom = vizact.sequence(vizact.move(0,0,(0.5/time),time), vizact.move(0,0,(-0.5/time),time), (30/time))
sequences.append(MoveRoom)
sequences.append( vizact.call( WriteFlag ) )
MovingRoom = vizact.sequence(sequences, 1)


This made it so that the picture moved .5m/s forward for 1 second and .5m/s backward for 1 second (it did that a total of 30 times which added up to 60 seconds). The second iteration it moved .25m/s (.5/2) for 2 seconds forward and backward and it did that 15 times (30/2) for a total of 60 seconds. The third iteration it moved .167m/s (.5/3) forward and backward for 3 seconds and it did this 10 times (30/3) for a total of 60 seconds. ETC ETC ETC ETC In each case it was moving a total of .5 meters forward and backward it was just doing it at a slower velocity over a longer period of time.

Now I need to keep it semi-proportional to that. Namely, I need it to move .12m forward for .05 seconds and .12m backward for .05 seconds and to do that for a minute. (Just like above I need it to move a total of .12 meters (in this case) forward and backward and do it at a faster velocity over a shorter period of time.

So I need my movetime list to be like: movetime = [.05, .25, .75, 1, 2]. So it should start off moving very fast over a short distance and then gradually move slower over that same short distance. And each "iteration" needs to be a minute long. I know I'm missing something/my formula/equation is off/wrong, but I can't figure it out. If I'm dividing 30 by .05 that equals 600. So it should do that iteration 600 times which would end up being 60 seconds long. But it doesn't. It only does it a couple of times (which ends up being 2.4 seconds long).

Does that make sense?
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 11:56 PM.


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