Scolring - Forum

Entraides et échanges autour de la technologie Scol - Informations and exchanges on the Scol technology

Vous pouvez changer la langue de l'interface une fois inscrit - You can change the language once registered

You are not logged in.

#1 25-Mar-2019 17:21:33

shahbiz8
Member
From: Malaysia
Registered: 25-Feb-2016
Posts: 262

Set object offset position to screen/camera size

Hello,

How to set object offset position to the side of screen?
phone doesn't have same size... some object cannot be seen.

Offline

#2 25-Mar-2019 17:30:06

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 4,508
Website

Re: Set object offset position to screen/camera size

Hello,

you mean when you want to place an object in a camera view ?
This only depends of the screen ratio.
You should set your OS3D 3D view near 4/3 and place the camera / object.
So it should be in view of all devices.

Maybe a plugit to retrieve the viewport ratio could help update your coordinates on runtime

Offline

#3 25-Mar-2019 17:54:07

shahbiz8
Member
From: Malaysia
Registered: 25-Feb-2016
Posts: 262

Re: Set object offset position to screen/camera size

I want parent/set offset position of 3d menu object to screen

https://drive.google.com/open?id=1gm_wZ … E7hm2JkFXh

Offline

#4 25-Mar-2019 18:06:48

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 4,508
Website

Re: Set object offset position to screen/camera size

You mean for 2D elements ?
Sorry I don't understand

Offline

#5 25-Mar-2019 18:08:00

shahbiz8
Member
From: Malaysia
Registered: 25-Feb-2016
Posts: 262

Re: Set object offset position to screen/camera size

it is 3d menu button with animation... not 2d

Offline

#6 25-Mar-2019 18:15:34

shahbiz8
Member
From: Malaysia
Registered: 25-Feb-2016
Posts: 262

Re: Set object offset position to screen/camera size

Offline

#7 26-Mar-2019 04:09:15

shahbiz8
Member
From: Malaysia
Registered: 25-Feb-2016
Posts: 262

Re: Set object offset position to screen/camera size

Suggestion:

create like this for 3d object.. so can set it position due to screen

https://drive.google.com/open?id=1b-hrC … muU-uPTCjr


or automatic set the offset postion for all 3d object in the scene

Last edited by shahbiz8 (26-Mar-2019 04:20:51)

Offline

#8 26-Mar-2019 09:23:14

Xeonadow
Scol language & OpenSpace3D developer
Registered: 28-Jul-2017
Posts: 45

Re: Set object offset position to screen/camera size

Hello
Is it a "Menu" plugIT that you are using ? If so, you should be able to switch it to 2d mode and get a similar interface to the one you suggest.
Interface positionning documentation : http://www.openspace3d.com/documentatio … ition.html
"Menu" plugIT documentation : http://www.openspace3d.com/documentatio … lugit.html

Offline

#9 26-Mar-2019 10:50:00

shahbiz8
Member
From: Malaysia
Registered: 25-Feb-2016
Posts: 262

Re: Set object offset position to screen/camera size

No, i'm not using menu plugit... i dont know how to use it...
maybe it can help.. i will try to understand it first..
thanks

Offline

#10 26-Mar-2019 15:25:03

Xeonadow
Scol language & OpenSpace3D developer
Registered: 28-Jul-2017
Posts: 45

Re: Set object offset position to screen/camera size

You're welcome. If the Menu plugIT is not fitting for your intent, please provide us with more details about the plugITs you are already using, how you are using them and what you want to achieve. There might be an easier or better solution to your problem.

Offline

#11 26-Mar-2019 16:09:13

shahbiz8
Member
From: Malaysia
Registered: 25-Feb-2016
Posts: 262

Re: Set object offset position to screen/camera size

I'm create 3d menu button like this... just using object click plugit..

https://drive.google.com/open?id=1vXviB … 7hceDzIMsj

but.. in some phone the side button see like this

https://drive.google.com/open?id=19EyPI … jJC88MvV7w

Offline

#12 26-Mar-2019 16:42:03

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 4,508
Website

Re: Set object offset position to screen/camera size

well so I think the best solution should be to manage manually the screen ratio.

Add an offset dummy to your menu, and when you show it your compute the screen ratio first, then depending of the know ratio you move the offset dummy with object position plugit.

you can put this code in the link to compute the screen ratio and adjust the offset value:

;[code]
let 0.5 -> offset in
let V3DgetDefaultViewport (V3DgetSessionView c3dXsession) -> vp in
let SO3ViewportGetPixelPositionSize vp.V3D_viewport -> [_ _ vw vh] in
let (itof vw) /. (itof vh) -> ratio in
ftoa (offset *. ratio)
;[/code]

remove the ";"

Offline

#13 26-Mar-2019 17:25:20

shahbiz8
Member
From: Malaysia
Registered: 25-Feb-2016
Posts: 262

Re: Set object offset position to screen/camera size

I didn't understand how to do that.. I send the file to your email

Offline

#14 29-Mar-2019 07:27:57

shahbiz8
Member
From: Malaysia
Registered: 25-Feb-2016
Posts: 262

Re: Set object offset position to screen/camera size

Hi Arkeon,

I have done some test.. It works

You should add it in plugit

Thank you

Offline

#15 29-Mar-2019 09:32:13

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 4,508
Website

Re: Set object offset position to screen/camera size

this works only because your camera have a 1° FOV
the calculation need to take the camera FOV into account to make something more generic

Offline

#16 18-Apr-2019 04:31:29

shahbiz8
Member
From: Malaysia
Registered: 25-Feb-2016
Posts: 262

Re: Set object offset position to screen/camera size

Hello Arkeon,

I still have a problem with this..
I send to email

Offline

#17 19-Apr-2019 12:52:06

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 4,508
Website

Re: Set object offset position to screen/camera size

(select the xml code, copy and past in OS3D plugITs view)

<plugins>
    <plugin name="object+position" source="objects%2fobjectposition%2fobjectposition%2exml">
        <instance py="10" px="54" name="object+position+inst" comment="">
            <param name="object"><![CDATA[1.master_dummy]]></param>
            <param name="local"><![CDATA[1]]></param>
            <param name="posx"><![CDATA[0.000000]]></param>
            <param name="posy"><![CDATA[0.000000]]></param>
            <param name="posz"><![CDATA[0.000000]]></param>
            <param name="angx"><![CDATA[0.000000]]></param>
            <param name="angy"><![CDATA[0.000000]]></param>
            <param name="angz"><![CDATA[0.000000]]></param>
            <param name="init"><![CDATA[0]]></param>
        </instance>
    </plugin>
    <plugin name="on+init" source="misc%2foninit%2foninit%2exml">
        <instance py="10" px="47" name="on+init+inst" comment="">
            <link action="Set+scale" instance="object+position+inst" group="Scene" event="Init"><![CDATA[[code]
let V3DgetDefaultViewport (V3DgetSessionView c3dXsession) -> vp in
let SO3ViewportGetPixelPositionSize vp.V3D_viewport -> [_ _ vw vh] in
let 1080.0 /. 1920.0  -> base in
let (itof vw) /. (itof vh) -> ratio in
  if (ratio <. 0.5) then
    ftoa 0.75
  else
    ftoa 1.0
[/code]]]></link>
        </instance>
    </plugin>
</plugins>

Offline

#18 19-Apr-2019 18:29:02

shahbiz8
Member
From: Malaysia
Registered: 25-Feb-2016
Posts: 262

Re: Set object offset position to screen/camera size

Thank you very much!!

Offline

Board footer

Powered by FluxBB