RaycastHit hitInfo;
If (Physics. Raycast (ray, out hitInfo))
{
//Debug. DrawLine (ray. Origin, hitInfo. Point);//draw the rays in the scene view to see the ray is emitted by the camera
GameObject gameObj=hitInfo. Starts. GameObject;
//the Debug Log (gameObj. Name);
SelectObj=gameObj;
Vector3 Mousepoint=Camera. Main. ScreenToWorldPoint (Input. MousePosition);
MouseDownPostion=new Vector3 (gameObj. The transform. The position. The X-ray Mousepoint. X, gameObj. The transform. The position. The y - Mousepoint. Y, 0).
IsMouseDown=true;
}
Starts in the box to detect collisions, but the goal is the Sprite, contains transparent channel, so I want to point in the transparent parts will not be collision detection to do or provide the train of thought
CodePudding user response:
Calculate the focus of MouseDownPostion vector with the pictures in the world, images captured by the focus on Teature2d. Again GetPixcel (x, y). If the alpha==0