Answer the question
In order to leave comments, you need to log in
I have a rendering of random primitives (cubes), how can I make sure that they do not go into each other when rendering?
def createRandomObjects(cam):
global obj, scenes
k_scatter = 1.0
scenes=[]
obj=[]
for i in range(0,num_boxes): #size
of objects
szx=randrange(169,200)
szy=randrange(169,200)
szz=randrange( 199,200)
sz=int(np.linalg.norm((szx, szy, szz)))
z=randrange(cam.min_dist+int(sz*1.3), cam.max_dist-sz)
vROT=[0.45.0 ]
vROT/=np.linalg.norm(vROT)
vROT=np.insert(vROT, 0, randrange(0, 45))
pose=
box = Box(pose[0], pose[1], pose[2])
obj.append( box)
poses.append(np.asarray(pose))
Answer the question
In order to leave comments, you need to log in
> how can I make sure that they do not go into each other when drawing?
do not position them when drawing so that they go into each other.
How not to position them like that? Well, if it's something moving, then implement collision detection and the corresponding physics. If they are static, and it's only a matter of generation - well, implement the simplest grid and do not refill already occupied cells. Without a specific goal, it's hard for you to suggest something.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question