#1
|
|||
|
|||
Objects overlapping
Hey there!
I'm new to Vizard and to Python. I have to set a few cylinders to random positions, but they shouldn't overlap in any way. I don't really know how to ensure this. I thought of an array that holds all the positions (resp. the areas) of the already loaded cylinders and comparing every new random position with it before loading the new cylinder. Now I wonder if there is an easier way to handle this?! |
#2
|
|||
|
|||
You could add a proximity sensor to each cylinder and add each cylinder as a target. Each sensor and target would get added to the proximity manager. Then when you create/spawn the cylinder and sensor if one of the other cylinder targets overlaps the proximity it calls a "try respawn" function. I would look at the following documentation pages here for details:
http://docs.worldviz.com/vizard/inde...nsors%7C_____4 http://docs.worldviz.com/vizard/inde...nsors%7C_____2 http://docs.worldviz.com/vizard/inde...nsors%7C_____3 What you said in your post could work fine, but its not very extendable. If you have different sized objects it could be a pain to get it working. With this you might have an easier time and there is less mathy stuff involved in regards to checking positions of objects, etc. |
#3
|
|||
|
|||
Thank you so much for your help
|
#4
|
|||
|
|||
Hey again!
I tried to use the proximity sensors now, but I think it is not the solution I am looking for. (Although I love the sensors and using it for some other things now ) Maybe my description of what I am trying to do was inaccurate. What I want to implement is a scene for an experiment where the cylinders are already initialized. If I understand correctly the sonsors are checking if a target enters/exits, but thats not happening when initializing. The new cylinder is "just there" at a moment. Is there still a way to get it working with the sensors? |
#5
|
|||
|
|||
Quote:
Your original idea wasn't a bad one though. You could still do it that way. Keep all the cylinders in an array along with their positions and manually loop through them to ensure they are far enough from each other. |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Trouble picking text3d objects | Salvar | Vizard | 4 | 12-01-2010 03:07 PM |
static or dynamic objects | shahramy | Vizard | 2 | 11-10-2010 12:32 AM |
Semi-circle array containing target and distractor objects | ptjt255 | Vizard | 3 | 08-04-2009 03:09 AM |
simply overlapping objects | chris | Vizard | 3 | 04-28-2008 12:39 PM |
Could not find plugin to load objects... | halley | Vizard | 1 | 05-30-2006 11:01 AM |