Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: dblincoeii on February 25, 2019, 06:35:43 PM
-
Need help with figuring this out. I have a scene with a backbone, nerves, arteries ligaments etc. The user can rotate up/down/left/right and zoom in/out on the to view the spine at different angles. I would like to have labels that point out nerves, individual vertebra, etc. I would like the label only to be seen when that mesh can be seen by the camera (this camera is not the main camera). I also would like a line from the label to the closest part of the mesh seen by the camera. I've tried with 3d text in the scene, but I think I would prefer if it were 2d text that is matching the 3d points. Any ideas?
Thanks in advance for any and all help!
-
You can shoot a ray from the camera into the scene, and the object it collides with gets the label (if you want to show more labels at once, you could fire several parallel rays).
Then, you need to do a complicated and counterintuive trick where the world space coordinates are translated to a screen space coordinates. Maybe someone can fill in. It‘s the same principle that is needed for mouse pointers, just in reverse.
When you have the screen space coordinates, you can calculate an offset, and connect both with a “line-draw” component and action, and add the label to one of the points.
These are just some pointers, hope it helps.
-
Hi.
In this case i would actually do the raycast from the objects towards the camera (have a collider in front of the camera to receive the raycast.)
So if something else would be in the way it would not hit the camera.
Then you can use "Ugui Ui To World Point" to position the ui text/label
-
You can shoot a ray from the camera into the scene, and the object it collides with gets the label (if you want to show more labels at once, you could fire several parallel rays).
Then, you need to do a complicated and counterintuive trick where the world space coordinates are translated to a screen space coordinates. Maybe someone can fill in. It‘s the same principle that is needed for mouse pointers, just in reverse.
When you have the screen space coordinates, you can calculate an offset, and connect both with a “line-draw” component and action, and add the label to one of the points.
These are just some pointers, hope it helps.
Thanks for the ideas! I'll see what I can implement.
-
Hi.
In this case i would actually do the raycast from the objects towards the camera (have a collider in front of the camera to receive the raycast.)
So if something else would be in the way it would not hit the camera.
Then you can use "Ugui Ui To World Point" to position the ui text/label
Great idea! Stay tuned!
-
Hi.
In this case i would actually do the raycast from the objects towards the camera (have a collider in front of the camera to receive the raycast.)
So if something else would be in the way it would not hit the camera.
Then you can use "Ugui Ui To World Point" to position the ui text/label
Well I've been trying on/off to make progress on this but keep coming to a halt when I use ray cast. For some reason I can only cast to a vector from an object not continually towards the camera. How do I work around that. Also, the rays cast from the mesh are always from the anchor point of the mesh to the camera pivot point correct? So does this work if a larger object is behind a smaller? If the smaller is occluding the pivot of the larger object it still is considered hidden, even if you can see it on either side of the smaller object. Is that correct or am I thinking about this the wrong way?