WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 06-04-2015, 09:16 AM
lalechuza lalechuza is offline
Member
 
Join Date: Jun 2015
Posts: 7
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?!
Reply With Quote
  #2  
Old 06-04-2015, 12:19 PM
MissingAFew MissingAFew is offline
Member
 
Join Date: Apr 2015
Posts: 15
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.
Reply With Quote
  #3  
Old 06-04-2015, 01:08 PM
lalechuza lalechuza is offline
Member
 
Join Date: Jun 2015
Posts: 7
Thank you so much for your help
Reply With Quote
  #4  
Old 06-09-2015, 01:14 AM
lalechuza lalechuza is offline
Member
 
Join Date: Jun 2015
Posts: 7
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?
Reply With Quote
  #5  
Old 06-11-2015, 12:26 PM
MissingAFew MissingAFew is offline
Member
 
Join Date: Apr 2015
Posts: 15
Quote:
Originally Posted by lalechuza View Post
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?
Well, what I was imagining was that when you create your cylinders in random spots, if a cylinder is too close to another cylinder then the proximity sensor would be aware that its too close and call a function to move that cylinder. This wouldn't be initializing their position before the program starts, it would be resetting their position during runtime until the cylinders are no longer touching/overlapping. Once they are no longer overlapping they will no longer be moved. This could be a very quick process and happen in a fraction of a second, depending on the number of cylinders and the area the cylinders are allowed to be in. Worst case, the space isn't big enough for them all and it continues to move the cylinders around randomly and it never stabilizes.

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.
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
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


All times are GMT -7. The time now is 11:52 PM.


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