- Home /
can i let the sphere follow a point(x.y. or.z) on plane?
hi
i am beginner in unity.
how can i let the sphere follow a point on plane? in this case center of face detection. look at the picture. thx
be more specific, follow a point on plane, when make a click on the plane do the sphere go to the point? just that, or when u past the mosue over the plane the sphere follow it everytime. The sphere can be only on the plane limits?
what i wanna do is that sphere follows center of face everytime. and as you told me yes just on the plane.
i have face.x and face.y position information but it is just on plane limited.
do you have an idea?
Answer by corumlee · Jan 25, 2018 at 03:32 PM
what i wanna do is that sphere follows center of face everytime. and as you told me yes just on the plane.
i have face.x and face.y position information but it is just on plane limited.
here is part of code
private void faceDetector()
{
currentFrameBgr = cvCapture.QueryFrame().ToImage<Bgr, byte>();
Texture2D tex = new Texture2D(640, 480);
if (currentFrameBgr != null)
{
Image<Gray, byte> grayFrame = currentFrameBgr.Convert<Gray, byte>();
var faces = _cascadeClassifier.DetectMultiScale(grayFrame, 1.1, 10, new System.Drawing.Size(frameWidth/8, frameHeight/8));
foreach (var face in faces)
{
currentFrameBgr.Draw(face, new Bgr(0, 255, 0), 3);
FaceCenterPointX = face.X;
FaceCenterPointY = face.Y;
}
//Convert this image into Bitmap, the pixel values are copied over to the Bitmap
currentFrameBgr.ToBitmap();
MemoryStream memstream = new MemoryStream();
currentFrameBgr.Bitmap.Save(memstream, currentFrameBgr.Bitmap.RawFormat);
tex.LoadImage(memstream.ToArray());
mt.mainTexture = tex;
}
}
Your answer
Follow this Question
Related Questions
Camera rotation around player while following. 6 Answers
Update position of an object to match a high velocity object and still allow OnMouseOver() 1 Answer
How to find total distance from start to end of an array which stores positions in vector3? 2 Answers
I can't change my players position manually 0 Answers
LineRenderer position different in editor than player 0 Answers