Home › Forums › General Questions › Interface object in Ortho view
- This topic has 11 replies, 3 voices, and was last updated 6 days, 22 hours ago by David Duperron.
-
AuthorPosts
-
2024-11-13 at 10:51 am #78692David DuperronCustomer
Hi there!
I’ve got some interface objects (a North indicator) parented to an Orthographic camera, that I want to display on the top left corner.
I use the “fit to camera edge” feature in Blender that appears when an object is parented to a camera.
The object is then visible in this corner, but its scale varies when zooming in or out!
How can I keep it to a constant size??
Thanks for the help!David
2024-11-13 at 3:35 pm #78698xeonCustomerThe indicator should be:
1. Parented to the ortho camera
2. Have its parent inverse cleared
3. Then repositioned to desired location if neededXeon
Route 66 Digital
Interactive Solutions - https://www.r66d.com
Tutorials - https://www.xeons3dlab.com2024-11-13 at 4:30 pm #78699David DuperronCustomerThanks Xeon, I will try again, even if I think I did all this the first time… will keep you posted!
2024-11-13 at 11:30 pm #78709xeonCustomerEven if you parented the object to the camera…it should stay locked to the camera regardless of zoom and movement of the camera. So it shouldn’t scale….but when you use Fit to Edge the clearing of the Clear Parent Inverse will make it behave correctly.
Xeon
Route 66 Digital
Interactive Solutions - https://www.r66d.com
Tutorials - https://www.xeons3dlab.com2024-11-14 at 8:03 am #78737David DuperronCustomerHi Xeon,
Tried it several times but it does not work for me… when I parent an object to an ortho camera, and use the “fit to camera” option, the object scales like the main scene when I zoom in/out, no matter what…
With perspective cameras it works without any issue, but not with ortho cameras… would be curious to have the developpers point of view about that?? @yuri?2024-11-14 at 8:13 am #78739kdvParticipantWith perspective cameras it works without any issue
because perspective cameras instead of zooming just move along their Y axis back an forth. on the contrary, ortho cameras are using real zooming.
Puzzles and JS coding. Fast and expensive.
If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.
2024-11-14 at 9:24 am #78741David DuperronCustomerHi @kdv! Yes I noticed this difference. But I don’t know how to counteract the zoom effect on the object that is parented to the camera.
I thought I could play on the scale of the object, that would be “linked” to the ortho zoom factor, but I cannot make it work…
I guess I will have to fall back to an HTML overlay when in Ortho mode.2024-11-14 at 9:27 am #78742kdvParticipantsmth like this can do the trick
function setObjectScale(mesh, factor) { if (app.camera.isOrthographicCamera) factor = ((app.camera.top - app.camera.bottom) / app.camera.zoom) / factor; else factor = (mesh.position.distanceTo(app.camera.position) * Math.tan(Math.PI * app.camera.fov / 360) * 2) / factor; mesh.scale.set(1, 1, 1).multiplyScalar(factor); }
Puzzles and JS coding. Fast and expensive.
If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.
2024-11-14 at 3:14 pm #78751David DuperronCustomerHi @kdv!
Yes I did not think about this function! You’re right we are almost there. I can keep the object to a constant scale relative to the viewport with this, but the offset from the left edge (and top edge) of the window is also scaled. I need to find where I can adjust this distance… if this is possible…2024-11-14 at 3:49 pm #78757David DuperronCustomer2024-11-14 at 6:57 pm #78765kdvParticipantbut the offset from the left edge (and top edge) of the window is also scaled
I don’t see this happening
Puzzles and JS coding. Fast and expensive.
If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.
2024-11-15 at 10:34 am #78802David DuperronCustomerI don’t know why but my object’s offset is linked to the zoom factor of the Ortho camera…
The good news is: I managed to couteract this effect by multiplying by the same “factor” as the object’s scale… just one more line in the function… -
AuthorPosts
- You must be logged in to reply to this topic.