WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 02-17-2009, 01:26 PM
durf durf is offline
Member
 
Join Date: Feb 2009
Posts: 61
Making multiple blocks rise and fall with a sensor.

Hello,

Im trying to make a program that interacts with a sensor(ppt). Ill describe what I am trying to do:

Imagine a checkerboard.... each checker represents a block. The checkerboard is located horizontally on the x axis with a position starting position at lets say -10 on the y- axis.

The object of this program is when the ppt crosses over one of these blocks the block rises to y = 0. As the ppt moves off of the block the block falls back to y = -10.

My questions:

What is the best way to arrange all of these blocks at -10? position each image myself? a loop?(its the same image by the way just multiples of it)

How do I tell the block to rise when the sensor crosses over it?

What is the best way to make the block fall back to -10? gravity?

If I could just get some answers to get me going on this it would be much appreciated.

Thanks

Barry
Reply With Quote
  #2  
Old 02-18-2009, 01:39 AM
DrunkenBrit DrunkenBrit is offline
Member
 
Join Date: Dec 2008
Location: England
Posts: 25
Quote:
What is the best way to arrange all of these blocks at -10? position each image myself? a loop?(its the same image by the way just multiples of it)
Probably using a for loop.

Quote:
How do I tell the block to rise when the sensor crosses over it?
I've never used sensors before, but i'd imagine it will be a callback function that assigns the id of which block the sensor is over.

Then maybe a timer function callback that checks every 0.05 secs if a block is selected, increment it's Y value by e.g. 3 each call until it reaches 0 and then tell it to drop down again until it reaches -10.

(Why are you working from -10 in Y upto 0 and not 0 to +10 in Y? Any reason?)

Quote:
What is the best way to make the block fall back to -10? gravity?
I'd suggest you look at the physics tutorials in Vizard, going from what i've browsed over, this should take care of this for you if i.e. you create a plane that represents the ground at -10 in Y, when a block is selected and moving upwards to 0 you could disable physics specifically for this selected block, once it reaches 0 in Y, enable physics again and gravity should take care of bringing the block back down and the collision plane stop it going below -10 in Y, but also don't allow the block to bounce back up etc.

Check out the physics2.py tutorial, this demo's some balls hitting a ground, might be a starting point.

Note to Admin: Running physics2.py tutorial causes the window to close after a couple of seconds and "ODE Message: warning: destroying world containing grouped joints" is outputted constantly in the console window. I have to manually close winviz.exe through Task Manager before this stops.

As a start point you could just try and get the logic working with one block then add the others in there.
__________________
Software Developer
Virtalis Ltd.
www.virtalis.com
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 07:38 PM.


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