Working on that. It is a matter of adjusting the attachment point to match the animation. I have gotten the rover to move out but not angled and follow it as it lowers
Last edited:
So new rover and lander...
Thanks. I think I may have to do that. Have mesh groups of the rover. Then move those groups along the ramp. and to the ground. Then create a rover vessel there? And make the rover mesh groups disappear. But the draw back is you don't get the rover animations so the rover would remained stowed until it was on ground. But I guess I could animate the rover mesh on lander.
Any clue why rover is not going straight.
CHANGE4WHEELS:GV_CHANGE4WHEELSnew
STATUS Landed Moon
POS -33.4375000 41.1184070
[B][COLOR="Red"] HEADING -917798380887773310.00[/COLOR][/B]
ALT 0.987
AROT -131.248 -19.348 138.219
AFCMODE 7
NAVFREQ 0 0
END
if (rampstart == 1){ //ramp sequence
//double dc = simdt * LIFT_SPEED;
double dc = simdt * .1;
double dd = simdt * .06;
double de = simdt * .2;
double dh = simdt * .3;
SetAttachmentParams(LR2, ROVER[POS], ROVER[DIR], ROVER[ROT]);
{
if (step == 1)
{
sprintf(oapiDebugString(), "anim %2.2f anim %3.4f ", R3, R2);
R3 = (R3 - dc);
if (R3 < -2.3){
R3 = -2.3;
step = 0;
}
}
if (step == 2)
{
sprintf(oapiDebugString(), "anim %2.2f anim %3.4f ", R3, R2);
R3 = (R3 - de);//x
R2 = (R2 - dh);//y
if (R3 < -3.4){
R3 = -3.4;
step = 0;
}
}
}
}
//RAMP
anim_RAMP1 = CreateAnimation(0);
anim_RAMP2 = CreateAnimation(0);
anim_RAMP3 = CreateAnimation(0);
static UINT RAMPGrp0[1] = { 43 };//PANEL1
static MGROUP_ROTATE RAMP1(0, RAMPGrp0, 1, _V(0, - 2.130815, - 1.388644), _V(1, 0, 0), (float)(-120 * RAD));
parent = AddAnimationComponent(anim_RAMP1, 0, 1, &RAMP1);
static UINT RAMPGrp1[1] = { 41 };//PANEL1
static MGROUP_ROTATE RAMP2(0, RAMPGrp1, 1, _V(0, -1.083262, - 1.377369), _V(1, 0, 0), (float)(210 * RAD));
parent1 = AddAnimationComponent(anim_RAMP2, 0, 1, &RAMP2,parent);
//static MGROUP_ROTATE RAMP2a(0, RAMPGrp1, 2, _V(0, -1.083262, -1.377369), _V(1, 0, 0), (float)(90 * RAD));
//parent2 = AddAnimationComponent(anim_RAMP2, 0, 1, &RAMP2a, parent1);
static UINT RAMPGrp2[1] = { 42 };//PANEL1
static MGROUP_ROTATE RAMP3(0, RAMPGrp2, 1, _V(0, - 2.542481, - 1.386626), _V(1, 0, 0), (float)(160 * RAD));
AddAnimationComponent(anim_RAMP3, 0, 1, &RAMP3, parent1);
//RAMP1
if (RAMP1_status >= DOOR_RAISING) {
//sprintf(oapiDebugString(), "anim %2.2f ramp2 %2.2f ", RAMP1_proc, RAMP2_proc);
double da = simdt * .19;
if (RAMP1_status == DOOR_RAISING) {
if (RAMP1_proc > 0.0){
RAMP1_proc = max(0.0, RAMP1_proc - da);
RAMP2_proc = (RAMP2_proc + da/2);
}
else RAMP1_status = DOOR_UP;
}
else {
if (RAMP1_proc < 1.0) {
RAMP1_proc = min(1.0, RAMP1_proc + da);
RAMP2_proc = (RAMP2_proc + da/2);
}
//if (RAMP2_proc < 1.0) RAMP1_proc = min(1.0, RAMP2_proc + da);
else RAMP1_status = DOOR_DOWN;
}
SetAnimation(anim_RAMP1, RAMP1_proc);
SetAnimation(anim_RAMP2, RAMP2_proc);
}
if (RAMP2_status >= DOOR_RAISING) {
double da = simdt * LIFT_SPEED;
if (RAMP2_status == DOOR_RAISING) {
if (RAMP2_proc > 0.0) RAMP2_proc = max(0.0, RAMP2_proc - da);
else RAMP2_status = DOOR_UP;
}
else {
if (RAMP2_proc < .43) RAMP2_proc = min(.43, RAMP2_proc + da);
else RAMP2_status = DOOR_DOWN;
}
SetAnimation(anim_RAMP2, RAMP2_proc);
}
if (RAMP3_status >= DOOR_RAISING) {
double da = simdt * LIFT_SPEED;
if (RAMP3_status == DOOR_RAISING) {
if (RAMP3_proc > 0.45) RAMP3_proc = max(0.0, RAMP3_proc - da);
else RAMP3_status = DOOR_UP;
}
else {
if (RAMP3_proc < 1.0) RAMP3_proc = min(1.0, RAMP3_proc + da);
else RAMP3_status = DOOR_DOWN;
}
SetAnimation(anim_RAMP3, RAMP3_proc);
}
}
//new
static UINT ROVERRAMPGrp[1] = { 15 };//LEFTARM0
rms_anim[0] = new MGROUP_TRANSLATE(0, ROVERRAMPGrp , 1,_V(0, 0, -1.6) ); // TRANSLATE
anim_ROVERRAMP = CreateAnimation(0.0);
ROVERparent = AddAnimationComponent(anim_ROVERRAMP, 0, 1, rms_anim[0]);
rms_anim[1] = new MGROUP_ROTATE(LOCALVERTEXLIST, MAKEGROUPARRAY(arm1_tip), 3,_V(0, -2.130815, -.671), _V(0, 0, 1), (float)(0 * RAD)); // -447 .. +447
anim_ROVERRAMP1 = CreateAnimation(0.0);
hAC_arm = AddAnimationComponent(anim_ROVERRAMP1, 0, 1, rms_anim[1], ROVERparent);
//new ramp
xp1 = arm1_tip[1] - arm1_tip[0]; normalise(xp1);
xr1 = arm1_tip[2] - arm1_tip[0]; normalise(xr1);
//SetAttachmentParams(LR2, arm1_tip[0], xp1, xr1);
if (rampstart == 1){
double dc = simdt * LIFT_SPEED;
ROVERRAMP_proc = (ROVERRAMP_proc + dc);
SetAnimation(anim_ROVERRAMP, ROVERRAMP_proc);
sprintf(oapiDebugString(), "anim %2.2f ", ROVERRAMP_proc);
SetAttachmentParams(LR2, arm1_tip[0], xp1, xr1);
}
th_main[0] = CreateThruster(_V(0, 0, 0), _V(0, 1, 0), 7500, ph_main, RCS_ISP);
if (rampstart == 1){
//double dc = simdt * LIFT_SPEED;
//ROVERRAMP_proc = (ROVERRAMP_proc + dc);
//SetAnimation(anim_ROVERRAMP, ROVERRAMP_proc);
//sprintf(oapiDebugString(), "anim %2.2f ", ROVERRAMP_proc);
SetAttachmentParams(LR2, _V(0, -4.5, -5.3), _V(0, 1, 0), _V(0, 0, 1));
DetachChild(LR2, 0);
}
th_main[0] = CreateThruster(_V(0, 0, 0), _V(0, 1, 0), 10000, ph_main, RCS_ISP);
AddExhaust(th_main[0], 1, 0.3, _V(0, -2.8, 0), _V(0, -1, 0));
thg_main = CreateThrusterGroup(th_main, 1, THGROUP_MAIN);
th_rcs[0] = CreateThruster(_V(6, 0, 10), _V(0, -1, 0), RCS_THRUST, ph_main, RCS_ISP);
static const int ntdvtx = 3;
static TOUCHDOWNVTX tdvtx[ntdvtx] = {
{ _V(0, -3.28, 1.5), 26150.8, 18409.6, 3.2, 0.8 },
{ _V(-2, -3.28, -2.6), 26150.8, 18409.6, 3.2, 0.4 },
{ _V(2, -3.28, -2.6), 26150.8, 18409.6, 3.2, 0.4 }//,
SetTouchdownPoints(tdvtx, ntdvtx);