Dan's Orbiter page

Orbiter English => Orbiter English => Topic started by: gattico on 21 November 2014, 15:04:14

Title: Continuous Rotation of Animation in Dialogue box
Post by: gattico on 21 November 2014, 15:04:14
Hoping someone can help me here.  For my SkylabII and flexcraft , Pod2001,.... there are joints in the RMS that can rotate 360 degrees.  I know normal animation goes from 0-1.  Outside of a dialogue box I can have code like if animation proc >1 then it is 0 and <0 then 1.  So the joint can go around with out stopping.

BUT Not sure how to add that in the dialogue box.  This is what i have:

Code: [Select]
if (SendDlgItemMessage(hWnd, IDC_JOINT2UP, BM_GETSTATE, 0, 0) & BST_PUSHED) {
sts->JOINT2_proc = max(0.0, sts->JOINT2_proc - (t1 - t0)*ARM_OPERATING_SPEED);
sts->SetAnimationArm(sts->anim_JOINT2, sts->JOINT2_proc);

if (SendDlgItemMessage(hWnd, IDC_JOINT2DOWN, BM_GETSTATE, 0, 0) & BST_PUSHED) {
sts->JOINT2_proc = min(1.0, sts->JOINT2_proc + (t1 - t0)*ARM_OPERATING_SPEED);

sts->SetAnimationArm(sts->anim_JOINT2, sts->JOINT2_proc);
Title: Re: Continuous Rotation of Animation in Dialogue box
Post by: gattico on 24 November 2014, 12:49:38
This is what I have tried with no success:
Code: [Select]
if (SendDlgItemMessage(hWnd, IDC_SHOULDER_YAWRIGHT, BM_GETSTATE, 0, 0) & BST_PUSHED) {
sts->ARM1_proc = min(1.1, sts->ARM1_proc + (t1 - t0)*ARM_OPERATING_SPEED);
sts->SetAnimationArm(sts->anim_ARM1, sts->ARM1_proc);
}
else if (SendDlgItemMessage(hWnd, IDC_SHOULDER_YAWLEFT, BM_GETSTATE, 0, 0) & BST_PUSHED) {
sts->ARM1_proc = max(-.1, sts->ARM1_proc - (t1 - t0)*ARM_OPERATING_SPEED);
sts->SetAnimationArm(sts->anim_ARM1, sts->ARM1_proc);
}
if (ARM1_proc > 1) ARM1_proc = 0;
if (ARM1_proc < 0) ARM1_proc = 1;
and I get this:
Error   6   error C2065: 'ARM1_proc' : undeclared identifier   E:\orbiter2010p1A\Orbitersdk\samples\SKYLAB2SCAFFOLD\SKYLAB2SCAFFOLD.CPP   771   1   SKYLAB2SCAFFOLD


With out this on a rms arm you have limits.  But some joints like a ball joint have no limits
Title: Re: Continuous Rotation of Animation in Dialogue box
Post by: David413 on 24 November 2014, 18:44:07
In your two lines at the end that are checking the values of ARM1_proc,

   
Code: [Select]
                 if (ARM1_proc > 1) ARM1_proc = 0;
         if (ARM1_proc < 0) ARM1_proc = 1;

try preceding ARM1_proc with the "sts->" like they are earlier in the code:

   
Code: [Select]
                 if (sts->ARM1_proc > 1)sts-> ARM1_proc = 0;
         if (sts->ARM1_proc < 0)sts->ARM1_proc = 1;
Title: Re: Continuous Rotation of Animation in Dialogue box
Post by: gattico on 25 November 2014, 00:52:32
THANKS.  THAT worked
Title: Re: Continuous Rotation of Animation in Dialogue box
Post by: David413 on 25 November 2014, 02:09:36
 :beer: