Mesh deformation according to the shape of another object using RayIntersection

(2 posts) (1 voice)


No tags yet.

  1. KaeR

    new member
    Joined: Apr '14
    Posts: 9


    I have to planes in parallel: lower and upper. The lower one is much smaller. I would like to move vertices of the upper mesh but only those which are above the lower plane in Y. i was able to obtain this result using schematics.
    However, I needed to implement it in one block using VSL. After doing so I have some strange behavior. The whole upper mesh is moved up no matter whether vertices were above the lower plane or not. This one can be observed when the upper mesh is set to be the reference for RayIntersection. If it's NULL, there is no action. When I investigate which entity was intersect I get the upper mesh.

    Is there anything in the code below that prevents it from performing as i would like? I believe there is since it's not performing well.

    How to filter out entities to be intersect?

    How important is the position of a point on the ray? I was changing it thinking it would be an equivalent to the depth option but it didn't help.

    Thank you for any suggestions.

    I enclosed as well the whole composition.



    void main()
    	Vector vecDir;				//for an aribitrary point on a ray
    	IntersectionDesc desc;
    	for(int i=0;i<Upper_mesh.GetVertexCount();i++){
    		Upper_mesh.GetVertexPosition(i,vecPos);			//take the position of the ith vertex
    		vecDir = vecPos+Dir;							//specify an arbitrary point on ray. in this case it's the point one unit below the origin
    		int test = Source.RayIntersection(vecPos,vecDir,desc,Reference,CKRAYINTERSECTION_DEFAULT);	//check if intersection occurred; The upper mesh is the reference
    		if(test != 0)	//if there was a hit
    			Upper_mesh.SetVertexPosition(i,vecPos+Dist);	//move the ith vertex by Dist=(0,5,0)


    1. test_ray_with_vsl.cmo (412.7 KB, 4 downloads) 2 years old
    WARNING: Files uploaded in the forums are not monitored by 3DVIA and therefore might contain content that is malicious or offensive. Download at your own risk
    Posted 2 years ago #
  2. KaeR

    new member
    Joined: Apr '14
    Posts: 9

    In the meanwhile I found the problem. I should've performed intersection checking on the target, in may case the lower plane. I was mislead by the way it is performed using schematics.

    Posted 2 years ago #


You must log in to post.