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.
i've done some experimenting on my tablet, and everything works as it should, but I have encountered some issues for a user holding the tablet between two hands a navigating with (perhaps) short thumbs
you cannot control the camera at all if your finger only moves within the boundaries of the button. ( I don't know why that happens I'm sure it's obvoius)
if you move your finger across the button and hold it or release it before the finger leaves the button area, nothing happens either (which logically follows from the first observation)
assuming that you only want one finger(i.e. thumb) to control the button at one time (or at least have the option), you have to test to see that the button structure's PBTN_lInputs list is empty
so i'm wondering if this may work if
1. you only want one touchpoint on the button at any one time and
2. you want to continue camera movement even if your finger isn't presently moving on the button,and
3. you only want the camera to move if the touchpoint is on the button, and nothing happen if the finger moves off of the button
I copy and rename the button files to eviloctopusbutton, and with the new ones, add "Stopped_touchpoint_event" to the new button's eviloctopusbutton.xml file, then change the cbupdatecursor in ceviloctopusbutton.pkg a little bit:
fun cbUpdateCursor(inst, viewstr, id, sx, sy, vx, vy, btnstr)=
//if a touchpoint already exists on the button, don't do anything, i guess this test could be moved to the cbAddCursor function to only allow one touch point on the button at once, this is something the author could set in the editor
if ((hd btnstr.PBTN_lInputs) != nil) then nil else
//code here to test to see if touchpoint is even on the button. if it isn't, don't do anything, i think i can handle the algebra here
if (!btnstr.PBTN_bShow) || (btnstr.PBTN_win == nil) then nil else
(
let switchstr btnstr.PBTN_lInputs (itoa id) -> icontrol in
if (icontrol == nil) || (btnstr.PBTN_tLastPos == nil) then nil else
(
let icontrol -> [ppx ppy] in
//do calculation to see distance of sx and sy from button offset point (it could be the top,
//center or middle)
//convert distance from offset to percentage of total distance from offset to edge of button (this will depend on how one is measuring, from vertical or horizontal middle of button, vertical or horizontal top of button, vertical, or any other point in or along edge of button), the results being
//fhorizontal_percentage and fvertical_percentage
SendPluginEvent btnstr.PBTN_instance "Stopped_touchpoint_event" strcatn (ftoa fhorizontal_percentage )::" "::(ftoa fvertical_percentage)::nil nil;
mutate icontrol <- [sx sy];
);
);
);
0;;
if this works, it could be merged into the existing button client file, and option (react to movement on button surface only or something like that) could be set in the .xml and editor files.
you could set one button to be a throttle (moving forward and back as represented by up and down from a horizontal center), and another to set camera rotation and/or turning (by determining vertical and horizontal offsets from the button center.), emulating a trackball/pad of some sort.
Last edited by hebdemnobad (19-Nov-2014 21:27:15)
Offline
this is what the previous example do.
thx...which example are you talking about?
Offline
the example with the $1 / $2 in links
did you try it ?
yes, using the parameter: for pushed move> control
$1 0 $2
0 0 0
and
0 0 0
0 0 0
for release>control
with either fps or walkthough causes correct translation of the camera (either side to side along x axis or front to back along z axis), but the camera only moves when the touchpoint has left the button area. you have to initiate the drag with the touchpoint over the button, and then drag it off of the button.
I added a counter integer to the button struct to count how many times pushed move is called, and it is called when the finger is moving in the button area, but the cbcursorupdate is preventing camera movement somehow (something obvious i'm sure)
Last edited by hebdemnobad (19-Nov-2014 22:49:20)
Offline
hmmm
in the button code try removing the X Y ratio
let (itof (sx - px)) /. (itof msize) -> fx in
replace just by (itof (sx - px))
andd see if this is doing what you want
also try by a / 2 button size ratio
let (itof (sx - px)) /. (itof (msize / 2)) -> fx in
Offline
hmmm
in the button code try removing the X Y ratio
let (itof (sx - px)) /. (itof msize) -> fx in
replace just by (itof (sx - px))
andd see if this is doing what you wantalso try by a / 2 button size ratio
let (itof (sx - px)) /. (itof (msize / 2)) -> fx in
thx, i tried the (itof (sx - px)) method and (itof (sx - px)) /. (itof (msize / 2)) method, the camera won't move unless swipe initiated on button and continued off of button
i'm going to try my method (using an offset from a determined point in the button and converting it into a percentage) and see how that works
i have verified the push moved event is continuously called if you are moving your mouse around in a button
Offline
yes it is called each time you move only.
but what behavior are you looking for I don't understand ?
Using one button as a throttle for z movement and another as a trackball for x rotation and y rotation.
I think I'm almost there.
Offline
i guess i'm almost there but not yet there . perhaps there is something in the way i'm handling my algebra or even division that is messing things up. so the algebra has stumped me. maybe even the arithmetic:
i took the indents out of the code to make it a bit more readable. the plugit compiles and all of the ( and ) brackets are matched up to the let ->in and if else blocks:
i wired the plugit to the os3d editor console and fyoffsetpercentage always equals prints to a value of 0.0000. even though the numerator (offset) is almost always more or less than 0 and the denominator (total offset, which is the height of the button/2) is always >0.
am i supposed to use the absf somewhere and then make the number negative?
imagine a long vertical button going up the left hand side of the screen. moving your thumb up should get you a negative value (moving forward, -z when sent to the walkthrough plugit) and moving down should get you a positive value (moving backward, +z when sent to the walkthrough plugit and configured to $1 0 $2 for vx vy vz.
i posted the xml, editor, and client files to http://www.ifam.net/mediaoctopus3d/feedbackbutton.zip
fun cbUpdateCursor(inst, viewstr, id, sx, sy, vx, vy, btnstr)=
let V3DgetViewPosSize viewstr -> [screenx screeny screen_width screen_height] in
let btnstr.PBTN_iHeight -> buttonheight in
let ((screen_height-buttonheight)+(buttonheight/2))-> horizontalcenter in
let (sy-horizontalcenter)->offset in
let (buttonheight/2) -> total_offset in
//????? for some reason fyoffsetpercentage always equals 0.0 even though offset is almost always!=0 and total offset is always >0. i'm stumped, the algebra got me!
let (itof (offset/total_offset)) -> fyoffsetpercentage in
(
if (!btnstr.PBTN_bShow) || (btnstr.PBTN_win == nil) then nil else
(
let 0 -> xmov in
(
if (icontrol == nil) || (btnstr.PBTN_tLastPos == nil)then nil else
(
let icontrol -> [ppx ppy] in
(
mutate icontrol <- [sx sy];
SendPluginEvent btnstr.PBTN_instance "Pushed move" strcatn (itoa xmov)::(ftoa fyoffsetpercentage)::nil nil;
SendPluginEvent btnstr.PBTN_instance "sendtouchpointdata" strcatn "screen height is:"::(itoa screen_height)::"button height is:"::(itoa buttonheight):: "horizontal center is:"::(itoa horizontalcenter):: "total offset is:"::(itoa total_offset):: "actual offset is"::(itoa offset)::"id is: ":: (itoa id)::" vertical offset percentage is: ":: (ftoa fyoffsetpercentage)::nil nil;
);
0;
);
0;
);
0;
);
);
0;;
Last edited by hebdemnobad (20-Nov-2014 04:11:26)
Offline
I don't think you have to change anything to do what you need.
just add a button and set the y value "0 0 $2" to the Z in control
and add another button with Y X 0 value to the control
"0 0 0
$2 $1 0"
if you want to revert axis use a math vector multiply to * -1 between Pushed move and control
Offline
I don't think you have to change anything to do what you need.
just add a button and set the y value "0 0 $2" to the Z in control
and add another button with Y X 0 value to the control
"0 0 0
$2 $1 0"if you want to revert axis use a math vector multiply to * -1 between Pushed move and control
Thx arkeon I will try that..
Offline
I don't think you have to change anything to do what you need.
just add a button and set the y value "0 0 $2" to the Z in control
and add another button with Y X 0 value to the control
"0 0 0
$2 $1 0"if you want to revert axis use a math vector multiply to * -1 between Pushed move and control
Thx I'll try that , as for my code I'm dividing integers incorrectly, not separating event parameters and not obtaining handle to control list.
Last edited by hebdemnobad (20-Nov-2014 14:30:29)
Offline
AHHHAA!
I should have seen this sooner, but I guess that's the way this coding thing works.
In all the navigation plugits, if a widget has focus, the prerender callback executes:
set bnavstr.BNAV_move = [[0.0 0.0 0.0] [0.0 0.0 0.0]];
so no matter what, when you twiddle your fingers on a widget, nothing happens because that widget has focus
ok now i think i'm really close...
Offline
hooo good catch ^^
I will check this soon
almost a good catch....with either your version of the plugit (only sends second parameter if touchpoint moves) or mine (sends second parameter based on offset from center of button), the effects of the plugit event only result in camera movement once the widget loses focus.
The effects of the touchpoint work predictably but don't start until the buffer is tapped or swiped.something about the touchpoint being over a widget disables camera movement....perhaps this is happening at the c++ level with the s03 engine?
Below is the codeblock in basicnavigation that stops movement:
movement also stops when cbdisable is called, but in my scene i hadn't set another plugit to disable the navigation plugit and in the navigation plugit and i checked the enable control on init and active camera on init
hmmph
fun cbNavPreRender(inst, sessionstr, etime, bnavstr)=
let if (etime == 0) then 1 else etime -> etime in
let (itof etime) -> ftime in
let (1000.0 /. (itof SO3WorldGetFPS sessionstr.V3D_session)) -> ptime in
let ftime /. 1000.0 -> nbsec in
let [nbsec nbsec nbsec] -> vnbsec in
let sessionstr.V3D_sessionView -> viewstr in
let (V3DWidgetCtrlHasFocus viewstr) -> widgetctrl in
let if (widgetctrl != nil) && (SO3WidgetGetMouseEnable widgetctrl) && (SO3WidgetIsMouseOver widgetctrl) then 1 else 0 -> disablenavig in
// manage the case that a widget get the focus
if (disablenavig) then
(
set bnavstr.BNAV_lPressedKeys = nil;
set bnavstr.BNAV_move = [[0.0 0.0 0.0] [0.0 0.0 0.0]];
let SO3BodyGetVelocity bnavstr.BNAV_body -> [velx vely velz] in
SO3BodySetVelocity bnavstr.BNAV_body [0.0 vely 0.0];
SO3BodySetOmega bnavstr.BNAV_body [0.0 0.0 0.0];
0;
)
else
//move the camera
so i changed:
let if (widgetctrl != nil) && (SO3WidgetGetMouseEnable widgetctrl) && (SO3WidgetIsMouseOver widgetctrl) then 1 else 0 -> disablenavig in
to
let if (widgetctrl != nil) && (SO3WidgetGetMouseEnable widgetctrl) && (SO3WidgetIsMouseOver widgetctrl) then 0 else 0 -> disablenavig in
and
//let if (widgetctrl != nil) && (SO3WidgetGetMouseEnable widgetctrl) && (SO3WidgetIsMouseOver widgetctrl) then 0 else 0 -> disablenavig in
let 0 -> disablenavig in
and then i disabled the block of code following the disable test completely:
let sessionstr.V3D_sessionView -> viewstr in
let (V3DWidgetCtrlHasFocus viewstr) -> widgetctrl in
//let if (widgetctrl != nil) && (SO3WidgetGetMouseEnable widgetctrl) && (SO3WidgetIsMouseOver widgetctrl) then 0 else 0 -> disablenavig in
let 0 -> disablenavig in
// manage the case that a widget get the focus
if (disablenavig) then
(
//set bnavstr.BNAV_lPressedKeys = nil;
//set bnavstr.BNAV_move = [[0.0 0.0 0.0] [0.0 0.0 0.0]];
//let SO3BodyGetVelocity bnavstr.BNAV_body -> [velx vely velz] in
//SO3BodySetVelocity bnavstr.BNAV_body [0.0 vely 0.0];
//SO3BodySetOmega bnavstr.BNAV_body [0.0 0.0 0.0];
0;
)
else
//the camera should be moving!!! but it doesn't
yet still, if the touchpoint is over a widget, camera movement stops completely, with both of our versions of the button client file. the button i designed is working as expected. if i touch the upper part of the button (without a swipe, as in your version... i think that both methods have their strengths and are more options for the scene author), nothing happens until i touch a part of the buffer not covered by the button.
so the buttons are working fine, its something automatically disabling camera movement when a touchpoint is in contact with a widget or moving over a widget, lurking in the navigation plugits or so3 engine at a lower level.
Or once again I'm missing something obvious...
Last edited by hebdemnobad (20-Nov-2014 17:23:05)
Offline
hmm yes but this behavior is needed when you take the focus on a widget in 2D or 3D texture.
I'll look the best thing maybe should be to disable this test only on multi touch.
I'll look at this.
Offline
thinking that this may be an issue with dragging, i just tried setting up your version of the button
push event-> control walkthrough
0 0 2
0 0 0
if i push the button, the camera doesn't move until i touch a part of the buffer not covered by a button. so if i push one button, followed by another, followed by another, camera movement will only happen once i touch a part of the buffer not covered by a button
however, if i press a button or drag a button or whatever other way of interacting with the button, that button event will trigger a sound plugit for example, or make a dialog box appear, or write text to the text input/output plugit i wrote a couple of months ago....the lack of effects only applies to the 3d buffer/view or whatever i should refer to it as...i hope that helps.
Offline
hmm yes but this behavior is needed when you take the focus on a widget in 2D or 3D texture.
I'll look the best thing maybe should be to disable this test only on multi touch.I'll look at this.
I missed your post while I was posting just now...
thx!
Offline
man you know what ^^
there is an enable mouse option on the button plugit.
if you disable it you keep the multi touch and the test in navigation plugits just pass.
Offline
man you know what ^^
there is an enable mouse option on the button plugit.
if you disable it you keep the multi touch and the test in navigation plugits just pass.
Thx I'll try that and let you know the results.
Offline
it works it works it works!!!!!! thx man!!!!!
with your version of the plugit, not mine, no worries, i learned a bit doin
this is how i made a forward backward throttle:
button.pushed move -> 0 0 $2 \n 0 0 0-> walthrough.control
button.release -> 0 0 0 \n 0 0 0-> walkthrough.control
i haven't tried making a trackball yet, but i think i'll be able to do that based on the way of mapping paramters to inputs you showed me (and that is in your book, note to self rtfm)
i will experiment with your latest version of the walkthrough plugit, since it supports touchpoints... creating plugit action "disable touch" and doing this
setPluginInstanceCbTouchPointAdd inst mkfun6 @cbAddCursor nil;
setPluginInstanceCbTouchPointRemove inst mkfun4 @cbRemoveCursor nil;
setPluginInstanceCbTouchPointUpdate inst mkfun8 @cbUpdateCursor nil;
should work i think
if this is done, the user's thumbs won't unintentionally cause camera movement when moving off the interface. this will increase the feel of using a dedicated input device like a joystick or trackpad/trackball/whatever else.
i have found the walkthrough plugit better to use in a two thumbs situation, since i have to pres esc in order to allow me to regain control of the cursor (on both laptop and tablet). whenever you have to use a keyboard on a tablet (or worse a phone), it can frustrate the user.
Last edited by hebdemnobad (21-Nov-2014 15:23:45)
Offline
no there is not in the multi touch plugit because I don't know how the user could manage this easilly ^^ this is not like the mouse the user don't know which point correspond to which action.
in the button plugIT for the release I've clamped the x /Y values sent between 0 to 1 to avoid too high values.
Offline
the ergonomy you want is a directional button like on gameboy ?
if you press the top of the button it goes forward ... ?
you could make a specific plugit from the button code whete you use button state de change the button press bitmap, top, left, right, bottom and left + top, top + right ...
you could call it directionnal touch pad
Offline
no there is not in the multi touch plugit because I don't know how the user could manage this easilly ^^ this is not like the mouse the user don't know which point correspond to which action.
i don't quite understand...this means you set the touchpoint add calls in the walkthrough to do nothing?
will that disable the touchpoints on the buttons as well?
as for setting up a throttle and trackball. the throttle is a long vertical button on the left of the screen, the trackball is a square button to the lower right of the screen
i altered the throttle button as follows:
throttle.pushed move -> 0 0 $2 ax ay az -walkthrough.control
throttle.release ->0 0 0 ax ay az=> walkthrough.control
as for setting up links for the trackball, this is what i did:
trackball.pushed move-> vx vy vz $2 $1 0-> walkthrough.control
trackball.release-> vx vy vz 0 0 0->walkthrough control
i have encountered the following issues:
1. the first you pointed out before, which is that i must reverse the movement in the yaxis (which is mapped to the xaxis to simulate looking up and down). when i swipe up, the camera looks down. when i swipe down, the camera looks up. i tried using vector multiply but didn't get the settings right.
2. the second is i can simultaneously move forward with the throttle while looking up and down with the trackball, but i cannot move forward with the throttle and look side to side with the trackball...i think this is something in the walkthrough plugit that prevents you from rotating along the camera y axis and moving in the camera in the z axis at the same time....is this something i can override with button settings or the links between the trackball button and the walkthrough plugit? or can i set an override to allow movement and y rotation simultaneously in the client code of the walkthrough plugit itself?
3. the final is this: let's say i swipe up on the throttle, moving forward. then, while i haven't lifted the finger on the throttle yet, i start swiping to the left with my finger. when i release the throttle, i start moving to the right, even though i have swiped left. perhaps this is a link setting that i did wrong, above, or something else i don't know. if i swipe with the throttle, and begin an upward swipe with the trackball, when i release the throttle, the trackball continues moving as it would if i hadn't used the throttle at all.
but i really see this working. it's great, all thumbs navigation!
Offline