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 14-Nov-2014 16:28:16

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,477
Website

how to format tuple and/or string sent to walkthrough action cbControl

i'm trying to figure out how to properly control the walkthrough plugit but I'm having trouble understanding the form of the tuple that must be sent to the walkthrough plugit when (the plugit I am designing) undergoes an event named "Command"

let's say i want to make the shell to look up, although this question would apply to any type of movement/rotation

would

//psuedocode for plugit named mycontroller
let [0 0 0l]-> vector in
let [1 0 0l]-> rotation in
let itoa vector -> vector in
let itoa rotation -> rotation in
let vector::"\n"::rotation:: nil->commandstring  in
(
_DMSevent this (getPluginInstanceEvent constr.mycontroller_instance "Command")  commandstring nil;

be enough to make the camera shell rotate upwards along its x axis?

once the event message is sent to the walkthrough plugit, do i have to then send another message to stop the rotation? like

//psuedocode for plugit named mycontroller
let [0 0 0]-> vector in
let [0 0 0l]-> rotation in
let itoa vector -> vector in
let itoa rotation -> rotation in
let vector::"\n"::rotation:: nil->string to send  in
(
_DMSevent this (getPluginInstanceEvent constr.mycontroller_instance "Command") commandstring nil;

Offline

#2 14-Nov-2014 16:36:08

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

Re: how to format tuple and/or string sent to walkthrough action cbControl

look at the "control" event code from the joypad plugIt for example

Offline

#3 14-Nov-2014 16:57:13

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,477
Website

Re: how to format tuple and/or string sent to walkthrough action cbControl

arkeon wrote:

look at the "control" event code from the joypad plugIt for example

i see, so would this be the proper format to send  complete position and rotation information (from an event named "Command") to the walkthrough cbControl action:

//code to stop the walkthrough from moving or rotating that will be properly processed by walkthrough cbControl function
let 0.0-> vx in
let 0.0-> vy in
let 0.0-> vz in
let 0.0-> ax in
let 0.0-> ay in
let 0.0-> az in
(
_DMSevent this (getPluginInstanceEvent inst "Command") (strbuild ((ftoa vx)::(ftoa vy)::(ftoa -.vz)::nil)::((ftoa ay)::(ftoa ax)::(ftoa az)::nil)::nil) nil;
//more code here

Last edited by hebdemnobad (14-Nov-2014 16:59:32)

Offline

#4 14-Nov-2014 17:25:44

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

Re: how to format tuple and/or string sent to walkthrough action cbControl

this is values from -1 to 1 for translation and rotation
there is some possible behavior change as you can see in the oculus plugIT

Offline

#5 14-Nov-2014 17:45:20

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,477
Website

Re: how to format tuple and/or string sent to walkthrough action cbControl

arkeon wrote:

this is values from -1 to 1 for translation and rotation
there is some possible behavior change as you can see in the oculus plugIT

I don't even know what an oculus looks like.
it's ok, i'll create a plugit with some text controls that sends the values to the walkthrough Control action and see what happens...

Offline

#6 14-Nov-2014 18:52:31

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,477
Website

Re: how to format tuple and/or string sent to walkthrough action cbControl

this works:

fun deleteOb(inst)=


  0;;
  

fun cbmoverotatePreRender(inst, viewstr)=
//make camera shell rotate around y axis for ever when linked to walkthrough control action (without setting any parameters)...if you set the interger higher, the rotation is faster (i'm not sure if that is good coding or not but there it is
_DMSevent this (getPluginInstanceEvent inst "Control") strbuild ("0"::"0"::"0"::nil)::("0"::"1"::"0"::nil)::nil nil; 

0;;



fun newOb(inst)=

 setPluginInstanceCbPreRender inst @cbmoverotatePreRender;

 setPluginInstanceCbDel inst  @deleteOb; 
 0;;





fun IniPlug(file)=

  PlugRegister @newOb nil;

  setPluginEditor @dynamicedit;

  0;;

Offline

Board footer

Powered by FluxBB