check obj in out other object
-
On 26/08/2016 at 02:52, xxxxxxxx wrote:
Hello to all! How can I do a check with python to see if an object is inside another object area? I have a piramid and i want to know if an object is in or out! Cheers :slightly_smiling_face::slightly_smiling_face::slightly_smiling_face:
-
On 29/08/2016 at 02:48, xxxxxxxx wrote:
Hello Davide,
the complexity of this task depends highly on the precision you need.
The easiest would probably be a comparison based on bounding boxes, check GetMp() and GetRad() for this.But if you are looking for a precise solution based on volumes or actual shapes and will get arbitrarily complex. You'll almost certainly want to look into the GeRayCollider module. The SDK Team can't provide algorithms, so this will be a matter to be discussed within the community.
-
On 29/08/2016 at 10:05, xxxxxxxx wrote:
Hello Andrea, tnx for reply
At the moment i resolve this problem with the GeRayCollider but i use xpresso becouse i find problem with him in python -
On 29/08/2016 at 10:08, xxxxxxxx wrote:
Can you provide us some details on the problems you have with GeRayCollider?
A code snippet to reproduce the problem would be even better. -
On 29/08/2016 at 10:15, xxxxxxxx wrote:
This is my code (another code but same problem) :
import c4d
from c4d import *
from c4d.utils import GeRayCollider
from c4d.modules import mograph as mo
import math
#Welcome to the world of Pythondef main() :
Obj = op[c4d.ID_USERDATA,1]ObjPos= Obj.GetMg()
mg = gen.GetMg()
md = mo.GeGetMoData(op)
if md is None: return False
cnt = md.GetCount()
marr = md.GetArray(c4d.MODATA_MATRIX)
fall = md.GetFalloffs()
for i in reversed(xrange(0, cnt)) :
Ray=GeRayCollider()
Ray.Init(Obj)
Ray.Intersect(marr _.off,ObjPos.off,300000)
print Ray.GetIntersection(0)md.SetArray(c4d.MODATA_MATRIX, marr, True)
return TrueI understand the problem form me is to find the "object coordinates, this is not the abs and the rel coordinate, i need to understand the concept
-
On 31/08/2016 at 11:24, xxxxxxxx wrote:
Hi Davide,
sorry for the delay.
There's an article on matrix fundamentals in the Python documentation that may be helpful.
I'm sorry, if it may seem obvious to you, but can you please describe your actual problem? I guess the code you posted is supposed to be used in a MoGraph Python Generator? How am I supposed to use it? And what's the supposed outcome? So, what do you want to achieve (expected or correct result) and what happens instead?