Orbiter-Forum  

Go Back   Orbiter-Forum > Orbiter Space Flight Simulator > Orbiter SDK
Register Blogs Orbinauts List Social Groups FAQ Projects Mark Forums Read

Orbiter SDK Orbiter software developers post your questions and answers about the SDK, the API interface, LUA, meshing, etc.

Reply
 
Thread Tools
Old 02-13-2018, 12:27 PM   #46
martins
Orbiter Founder
Default

Quote:
Originally Posted by gattispilot View Post
 Well here is something I need help in:
Does that mean you have fixed your CTD problem, or have you given up on that?
Quote:
So this makes a MMU guy. But not sure how to get the guy back in.
That should be pretty straightforward:
  • listen to docking events (clbkDockEvent)
  • If the docked vessel is an MMU, delete it
martins is online now   Reply With Quote
Thanked by:
Old 02-15-2018, 11:46 AM   #47
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

refocused.


And I got the mmu part to work. We are going to try to have 3 eva guys. So 3 sets of keys. Eva guy1 -E eva guy 2 -W and eva guy 3. That way 3 different mesh/guys are made and created.

---------- Post added 02-14-18 at 07:14 AM ---------- Previous post was 02-13-18 at 07:41 AM ----------

New issue. We have noticed when we eva. It makes a NASAMMu vessel. Switch focus to the mmu vessel. BUT when you apply thrust the shuttle rcs fire.

No idea where to look in the code.

---------- Post added at 05:46 PM ---------- Previous post was at 07:14 AM ----------

So here is the Scn:
Code:
BEGIN_FOCUS
  Ship MMU1
END_FOCUS

BEGIN_CAMERA
  TARGET MMU1
  MODE Extern
  POS 8.466217 84.081557 105.710714
  TRACKMODE TargetRelative
  FOV 40.00
END_CAMERA

BEGIN_HUD
  TYPE Surface
END_HUD

BEGIN_MFD Left
  TYPE Orbit
  PROJ Ship
  FRAME Ecliptic
  REF Earth
END_MFD

BEGIN_MFD Right
  TYPE User
  MODE Multistage2015_MFD
END_MFD

BEGIN_SHIPS
ET-3:Multistage2015
  STATUS Orbiting Earth
  RPOS 3531435.752 1989435.578 5120047.757
  RVEL -4925.2405 -3576.4305 4948.5147
  AROT -1.081 2.084 -122.784
  AFCMODE 7
  PRPLEVEL 0:0.060118
  NAVFREQ 0 0 0 0
  XPDR 0
  CONFIG_FILE Config\Multistage2015\Space-Shuttle_STS-3new.ini
  GUIDANCE_FILE Config\Multistage2015\Guidance\guidance_shuttle_STS-3.txt
  CONFIGURATION 1
  CURRENT_BOOSTER 2
  CURRENT_STAGE 1
  CURRENT_INTERSTAGE 1
  CURRENT_PAYLOAD 2
  FAIRING 0
  MET 1079.202
  BATTERY 4320.798116
  STAGE_IGNITION_TIME 0.000000
  STAGE_STATE 2
  TELEMETRY_FILE Config\Multistage2015\Telemetry\guidance_shuttle_STS-3.txt
  ALT_STEPS 100.0,350.0,1400.0,35000.0
  PEG_PITCH_LIMIT 35.000
  PEG_MC_INTERVAL 0.100
END
MS_Camera:MS_Camera
  STATUS Landed Earth
  POS -80.6238630 28.6070927
  HEADING 180.57
  ALT 0.000
  AROT -118.284 -4.474 171.752
  AFCMODE 7
  NAVFREQ 0 0
  TARGET ET-3
END
STS-3:ShuttleConstellation2016NEW
  STATUS Orbiting Earth
  RPOS 3531135.359 1989248.168 5120117.587
  RVEL -4925.9468 -3576.8869 4948.6340
  AROT -128.055 20.161 -23.596
  VROT 0.2330 -0.0010 0.1464
  PRPLEVEL 0:0.996248
  THLEVEL 7:0.015554 8:0.015554 9:0.000003 10:0.000003 13:0.000510 14:0.000510
  NAVFREQ 0 0
  CONFIGURATION 3
  GEAR 0 0.0000
  HATCH 1 1.0000
  ARM_STATUS 0.5000 0.0000 0.0000 0.5000 0.5000 0.5000
  SAT_OFS_X 0.000000
  SAT_OFS_Y 0.000000
  SAT_OFS_Z 0.000000
  LIGHT 0 
  CARGODOOR 1 1.0000
END
MMU1:Nasa_MMU
  STATUS Orbiting Earth
  RPOS 3531104.157 1989225.501 5120128.653
  RVEL -4926.1159 -3576.9901 4948.7434
  AROT -127.683 51.955 129.742
  VROT -0.8787 -0.0719 -0.1510
  AFCMODE 7
  NAVFREQ 0 0
END
END_SHIPS
focus is on the MMU. but when I press the rcs control for the mmu the shuttles fire.

here is what I have for the h.
Code:
// ==============================================================
//                 ORBITER MODULE: Atlantis
//                  Part of the ORBITER SDK
//          Copyright (C) 2001-2012 Martin Schweiger
//                   All rights reserved
//
// Atlantis.h
// Class interface of Atlantis (Space Shuttle) vessel class
// module and associated subclasses (SRB, tank)
// ==============================================================

#ifndef __ATLANTIS_H
#define __ATLANTIS_H

#include "orbitersdk.h"
#include <math.h>



// ==========================================================
// Some Orbiter-related parameters
// ==========================================================

const double ORBITER_EMPTY_MASS = 104326.0;
// Orbiter empty mass [kg]

const double ORBITER_MAX_PROPELLANT_MASS = 21600.0;
// Amount of fuel the orbiter can hold in internal OMS tanks

const double ORBITER_MAIN_THRUST = 1668652.0 * 1.25;
// Vacuum thrust rating per main engine [N] (x3 for total)
// assuming vacuum thrust is 5/4 liftoff thrust

const double ORBITER_OMS_THRUST = 26700.0;
// Vacuum thrust per unit for Orbital Maneuvering System [N] (x2 for total)

const double ORBITER_RCS_THRUST = 7740.0;
// Vacuum thrust rating for attitude thrusters (Reaction Control System) [N]

const double ORBITER_MAIN_ISP0 = 4444.0; // 453s*9.81
const double ORBITER_MAIN_ISP1 = 3561.0; // 363s*9.81
// Vacuum and sea-level fuel-specific impulse for orbiter main engines [m/s]
// using H2/O2 (hydrogen/oxygen)

const double ORBITER_OMS_ISP0 = 3100;
const double ORBITER_OMS_ISP1 = 2500;
// Vacuum and sea-level fuel-specific impulse for Orbital Maneuvering System [m/s]
// using MMH/N2O4 (monomethyl hydrazine/nitrogen tetroxide)

const double ORBITER_RCS_ISP0 = 5000.0;
const double ORBITER_RCS_ISP1 = 4000.0;
// Vacuum and sea-level fuel-specific impulse for Reaction Control System [m/s]

const double GEAR_OPERATING_SPEED = 0.3;
// Opening/closing speed of landing gear (1/sec)
// => gear cycle ~ 3 sec

const double DOOR_OPERATING_SPEED = 0.007353;
// Opening/closing speed of payload bay doors (1/sec)
// This contains the door opening sequence (63 sec for each door) and an
// interval of 10 sec between the two door operations

const double RAD_OPERATING_SPEED = 0.025;
// Deployment/stowing speed of radiators (1/sec)
// => radiator cycle = 40 sec

const double RADLATCH_OPERATING_SPEED = 0.2;
// Release/engaging speed of radiator latches (1/sec)
// => radiator latch cycle = 5 sec

const double KU_OPERATING_SPEED = 0.0435;
// Deployment speed of the Ku Band antenna (1/sec)
// cycle is 23 sec

const double SPEEDBRAKE_OPERATING_SPEED = 0.20284;
// Deployment speed of the speedbrake (1/sec)
// cycle is 4.93 sec

const double ARM_OPERATING_SPEED = 0.005;
// RMS arm joint rotation speed (rad/sec)

const VECTOR3 ORBITER_CS = {234.8,389.1,68.2};
// Orbiter cross sections (projections into principal axes) [m^2]

const VECTOR3 ORBITER_CS_GEAR = {10.0,0.0,3.0};
// Contribution of fully extended landing gear to cross sections

const double MAX_GRAPPLING_DIST = 0.5;
// max distance between RMS tip and grappling point for successful grappling


// ==========================================================
// Thruster reference positions and thrust directions
// ==========================================================

const VECTOR3 THRUSTREF_SSME0      = {-1.55,-0.37,-12.5};
const VECTOR3 THRUSTREF_SSME1      = { 1.55,-0.37,-12.5};
const VECTOR3 THRUSTREF_SSME2      = { 0.0,  2.7, -12.5};
const VECTOR3 THRUSTREF_OMSL       = {-2.6,  3.3, -12.8};
const VECTOR3 THRUSTREF_OMSR       = { 2.6,  3.3, -12.8};
const VECTOR3 THRUSTREF_SRB        = { 0.0,  0.0, -20.4};

const double THRUSTPITCH_LAUNCH = -2.3*RAD;
const VECTOR3 THRUSTGIMBAL_LAUNCH = {0, sin(THRUSTPITCH_LAUNCH), cos(THRUSTPITCH_LAUNCH)};

const VECTOR3 THRUSTDIR_OMSL = { 0.19299542, -0.24495572, 0.95013129};
const VECTOR3 THRUSTDIR_OMSR = {-0.19299542, -0.24495572, 0.95013129};

// ==========================================================
// Docking port position
// ==========================================================

//const VECTOR3 ORBITER_DOCKPOS      = { 0.0, 2.40, 10.15};

// ==========================================================
// panel area identifiers
// ==========================================================

// define MFD function buttons
#define AID_CDR1_BUTTONS   1
#define AID_CDR2_BUTTONS   2
#define AID_PLT1_BUTTONS   3
#define AID_PLT2_BUTTONS   4
#define AID_MFD1_BUTTONS   5
#define AID_MFD2_BUTTONS   6
#define AID_MFD3_BUTTONS   7
#define AID_MFD4_BUTTONS   8
#define AID_MFD5_BUTTONS   9
#define AID_MFDA_BUTTONS  10
// D. Beachy: define power buttons
#define AID_CDR1_PWR      11
#define AID_CDR2_PWR      12
#define AID_PLT1_PWR      13
#define AID_PLT2_PWR      14
#define AID_MFD1_PWR      15
#define AID_MFD2_PWR      16
#define AID_MFD3_PWR      17
#define AID_MFD4_PWR      18
#define AID_MFD5_PWR      19
#define AID_MFDA_PWR      20
// MFD brightness buttons
#define AID_CDR1_BRT      21
#define AID_CDR2_BRT      22
#define AID_PLT1_BRT      23
#define AID_PLT2_BRT      24
#define AID_MFD1_BRT      25
#define AID_MFD2_BRT      26
#define AID_MFD3_BRT      27
#define AID_MFD4_BRT      28
#define AID_MFD5_BRT      29
#define AID_MFDA_BRT      30
// Panel R13L (payload bay operations)
#define AID_R13L_MIN     100
#define AID_R13L         100
#define AID_R13L_TKBK1   101
#define AID_R13L_TKBK2   102
#define AID_R13L_TKBK3   103
#define AID_R13L_TKBK4   104
#define AID_R13L_TKBK5   105
#define AID_R13L_TKBK6   106
#define AID_R13L_MAX     120

typedef struct {
	HINSTANCE hDLL;
	SURFHANDLE tkbk_label;
	HFONT font[1];
} GDIParams;

//class Atlantis_Tank;
//class AscentAPDlg;

// ==========================================================
// Interface for derived vessel class: Atlantis
// ==========================================================

class Atlantis: public VESSEL4 {
	//friend class AscentAP;
	friend class PayloadBayOp;
	friend BOOL CALLBACK RMS_DlgProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
public:
	AnimState::Action gear_status, spdb_status;
	Atlantis (OBJHANDLE hObj, int fmodel);
	~Atlantis();

	//AscentAP *AscentAutopilot() { return ascap; }
	//int RegisterAscentApMfd();
	//void CreateAscentAPDlg();
	//void DestroyAscentAPDlg();

	//void SeparateBoosters (double srb_time);
	// Jettison both SRBs from ET

//	void SeparateTank ();
	// Jettison ET from orbiter

	void GetSSMEGimbalPos (int which, double &pitch, double &yaw);
	void GetSRBGimbalPos (int which, double &pitch, double &yaw);

	void SeparateMMU (void);
	void ToggleGrapple (void);
	void ToggleArrest (void);
	void SetGearParameters (double state);
	//void Jettison ();
	void UpdateMesh ();
	void SetBayDoorPosition (double pos);
	void SetRadiatorPosition (double pos);
	void SetRadLatchPosition (double pos) {}
	void SetKuAntennaPosition (double pos);
	void SetSSMEPosition (double pos);
	void OperateLandingGear (AnimState::Action action);
	void RevertLandingGear ();
	void OperateSpeedbrake (AnimState::Action action);
	void RevertSpeedbrake ();
	void SetAnimationArm (UINT anim, double state);

	//double GetSRBThrustLevel (int which);
	// returns the thrust level from left (which=0) or right (which=1)
	// SRB, or 0 if SRB is detached

	void RegisterVC_CdrMFD ();
	void RegisterVC_PltMFD ();
	void RegisterVC_CntMFD ();
	void RegisterVC_AftMFD ();
	void RedrawPanel_MFDButton (SURFHANDLE surf, int mfd);

	int status; // 0=launch configuration
	            // 1=SRB's engaged
	            // 2=SRB's separated
	            // 3=Tank separated (orbiter only)

	double t0;          // reference time: designated liftoff time


	double gear_proc; // landing gear deployment state (0=retracted, 1=deployed)
	//double kubd_proc; // Ku-band antenna deployment state (0=retracted, 1=deployed)
	double spdb_proc; // Speedbrake deployment state (0=retracted, 1=deployed)
	double ldoor_drag, rdoor_drag; // drag components from open cargo doors
	bool center_arm;
	bool arm_moved, arm_scheduled;
	double center_arm_t;
	bool do_eva;
	bool do_plat;
	bool do_cargostatic;
	VECTOR3 ofs_sts_sat;
	VECTOR3 cargo_static_ofs;
	VISHANDLE vis;      // handle for visual - note: we assume that only one visual per object is created!
	MESHHANDLE hOrbiterMesh, hOrbiterCockpitMesh, hOrbiterVCMesh; // mesh handles
	char cargo_static_mesh_name[256];
	ATTACHMENTHANDLE sat_attach, rms_attach;
	VECTOR3 arm_tip[3];

	// Overloaded callback functions
	void clbkSetClassCaps (FILEHANDLE cfg);
	void clbkSetStateEx (const void *status);
	void clbkLoadStateEx (FILEHANDLE scn, void *vs);
	void clbkSaveState (FILEHANDLE scn);
	void clbkPostCreation ();
	void clbkFocusChanged (bool getfocus, OBJHANDLE hNewVessel, OBJHANDLE hOldVessel);
	void clbkPreStep (double simt, double simdt, double mjd);
	bool clbkPlaybackEvent (double simt, double event_t, const char *event_type, const char *event);
	int  clbkConsumeBufferedKey (DWORD key, bool down, char *kstate);
	void clbkVisualCreated (VISHANDLE vis, int refcount);
	void clbkVisualDestroyed (VISHANDLE vis, int refcount);
	void clbkAnimate (double simt);
	void clbkMFDMode (int mfd, int mode);
	void clbkRCSMode (int mode);
	bool clbkLoadGenericCockpit ();
	bool clbkLoadVC (int id);
	bool clbkVCMouseEvent (int id, int event, VECTOR3 &p);
	bool clbkVCRedrawEvent (int id, int event, SURFHANDLE surf);
	bool clbkDrawHUD (int mode, const HUDPAINTSPEC *hps, oapi::Sketchpad *skp);

	PayloadBayOp *plop; // control and status of payload bay operations


	void Revertextdoor(void);
	void ENTER_MMU(void);

protected:
	void LoadMeshes();
	// Load the meshes for cockpit and exterior

	void CreateSSME();
	// Initialise the thrusters for the shuttle main engines

	void CreateOMS();
	// Initialise the thrusters for the orbital maneuvering system

	void CreateRCS();
	// Initialise the thrusters for the reaction control system

	void CreateAirfoils();
	// Initialise airfoils, aerodynamic control surfaces and drag elements

	static void VLiftCoeff (double aoa, double M, double Re, double *cl, double *cm, double *cd);
	static void HLiftCoeff (double beta, double M, double Re, double *cl, double *cm, double *cd);
	// airfoil coefficient functions

	void DefineAnimations (void);
	// Initialises all animation objects
	//
	enum hatch_status { HATCH_UP, HATCH_DOWN, HATCH_RAISING, HATCH_LOWERING } EXT_status, ods_status;;
	//
private:
	void SetSSMEGimbal (const VECTOR3 &angle);
	// Set the gimbal positions for the shuttle main engines

	double GetAscentPitchRate (double tgt_pitch);
	// Autopilot function: returns the pitch rate for the specified
	// target pitch during launch phase (until ET separation)

	void AutoGimbal (const VECTOR3 &tgt_rate);
	// Automatic gimbal adjustment for SSME and SRB engines to correct
	// for CG shift, SRB thrust variations, atmospheric effects, etc.

	void AutoRCS (const VECTOR3 &tgt_rate);
	// Automatic RCS control for ascent autopilot

	//void LaunchClamps();
	bool EnableSSME (bool enable);
	void EnableOMS (bool enable);
	void EnableRCS (bool enable);

	bool SatGrappled() const { return GetAttachmentStatus (rms_attach) != 0; }
	bool SatStowed() const { return GetAttachmentStatus (sat_attach) != 0; }
	ATTACHMENTHANDLE CanArrest() const;

	//AscentAP *ascap;                           // ascent autopilot
	//int ascapMfdId;                            // ID for ascent autopilot MFD mode
	//Atlantis_Tank *pET;                        // pointer to ET object (if attached)
	DOCKHANDLE hDockET;                        // docking connector to ET

	VECTOR3 gimbal_pos;                        // gimbal settings for pitch,yaw,roll

	UINT anim_door;                            // handle for cargo door animation

	UINT anim_extdoor;                            // handle for cargo door animation


	UINT anim_rad;                             // handle for radiator animation
	UINT anim_gear;                            // handle for landing gear animation
	UINT anim_kubd;                            // handle for Ku-band antenna animation
	UINT anim_elev;                            // handle for elevator animation
	UINT anim_laileron;						   // handle for left aileron animation
	UINT anim_raileron;						   // handle for right aileron animation
	UINT anim_rudder;						   // handle for rudder animation
	UINT anim_spdb;                            // handle for speed brake animation
	UINT anim_ssme;                            // handle for SSME pitch gimbal animation
	UINT mesh_orbiter;                         // index for orbiter mesh
	UINT mesh_cockpit;                         // index for cockpit mesh for external view
	UINT mesh_vc;                              // index for virtual cockpit mesh
	UINT mesh_cargo;                           // index for static cargo mesh
	UINT mesh_platform;                        // index for payload platform mesh
	PROPELLANT_HANDLE ph_oms;                  // handles for propellant resources
	THRUSTER_HANDLE th_main[3];                // handles for orbiter main engines
	THRUSTER_HANDLE th_oms[2];                 // handles for orbiter oms engines
	THGROUP_HANDLE thg_main, thg_oms;          // handles for thruster groups

	// RMS arm animation status
	ANIMATIONCOMPONENT_HANDLE hAC_arm, hAC_sat, hAC_satref;
	MGROUP_TRANSFORM *rms_anim[6];
	MGROUP_TRANSFORM *ssme_anim[3];
	UINT anim_arm_sy, anim_arm_sp, anim_arm_ep, anim_arm_wp, anim_arm_wy, anim_arm_wr;
	double arm_sy, arm_sp, arm_ep, arm_wp, arm_wy, arm_wr;
	MGROUP_TRANSFORM *sat_anim, *sat_ref;
	bool reset_sat;
	OBJHANDLE hMMU, hSAT;
	bool render_cockpit;
	double mfdbright[10];
	//
	double  EXT_proc;
	//
	LightEmitter *engine_light;
	double engine_light_level;
	double DYNPRESSURE;  //get DYNAMIC pressure for rcs or control surfaces

	int light_status;
	SpotLight *spotlight1, *spotlight2, *spotlight3, *spotlight4, *spotlight5, *spotlight6;
	BEACONLIGHTSPEC spot_beacon[8];
	VECTOR3 beacon_col = _V(0.75, 0.75, 0.75);

















};


#endif // !__ATLANTIS_H


---------- Post added 02-15-18 at 05:46 AM ---------- Previous post was 02-14-18 at 05:46 PM ----------

So got that fixed.
I was a left over piece from the Ascentmfd.

I think for for variations the mass, fuel amount may need to be read from the scn?

Thanks for all the help
gattispilot is offline   Reply With Quote
Old 02-19-2018, 11:39 AM   #48
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

So I was able to add the new rms into the shuttle. BUt having an issue with code.

I can get the attachment to follow the animation.
stowed



Code:
arm_tip[0] = _V(-2.607,2,-6.344);
	arm_tip[1] = _V(-2.607,2,-7.344);
	arm_tip[2] = _V(-2.607,1,-6.344);

	sat_attach = CreateAttachment (false, ofs_sts_sat, _V(0,1,0), _V(0,0,1), "X");
	rms_attach = CreateAttachment (false, arm_tip[0], arm_tip[1]-arm_tip[0], arm_tip[2]-arm_tip[0], "G", true);

rms arm animation
Code:
void Atlantis::UpdateMesh ()
{
	// update animation states
	SetAnimation (anim_gear, gear_proc);
	SetAnimation (anim_spdb, spdb_proc);
	SetAnimation (anim_door, plop->BayDoorStatus.pos);
	SetAnimation (anim_rad,  plop->RadiatorStatus.pos);
	SetAnimation (anim_kubd, plop->KuAntennaStatus.pos);

	SetAnimationArm (anim_arm_sy, arm_sy);
	SetAnimationArm (anim_arm_sp, arm_sp);
	SetAnimationArm (anim_arm_ep, arm_ep);
	SetAnimationArm (anim_arm_wp, arm_wp);
	SetAnimationArm (anim_arm_wy, arm_wy);
	SetAnimationArm (anim_arm_wr, arm_wr);
	SetAnimationArm(anim_rms_ee, arm_wr);
Code:
// ***** 8. RMS arm animation *****
	// Note that the animation components can't be declared static here, since
	// their rotation parameters are modified by the respective parent transforms

	ANIMATIONCOMPONENT_HANDLE parent, parent2;

	static UINT RMSShoulderYawGrp[1] = { GRP_Shoulder_Yaw };
	rms_anim[0] = new MGROUP_ROTATE(midx, RMSShoulderYawGrp, 1,
		_V(-2.461, 1.487, 8.776), _V(0, 1, 0), (float)(-360*RAD)); // -180 .. +180
	anim_arm_sy = CreateAnimation(0.5);
	parent = AddAnimationComponent(anim_arm_sy, 0, 1, rms_anim[0]);

	static UINT RMSShoulderPitchGrp[1] = { GRP_SHOULDER_BOOM };
	rms_anim[1] = new MGROUP_ROTATE (midx, RMSShoulderPitchGrp, 1,
		_V(-2.461, 2.031, 8.764), _V(1, 0, 0), (float)(147*RAD)); // -2 .. +145
	anim_arm_sp = CreateAnimation(0.0136);
	parent = AddAnimationComponent (anim_arm_sp, 0, 1, rms_anim[1], parent);
	
	static UINT RMSElbowPitchGrp[2] = { GRP_ELBOW_BOOM, GRP_ELBOW_CAM_BASE };
	rms_anim[2] = new MGROUP_ROTATE (midx, RMSElbowPitchGrp, 2,
		_V(-2.5835,  1.841633,  2.41351), _V(1, 0, 0), (float)(-163.4*RAD)); // -160 .. +2
	anim_arm_ep = CreateAnimation(0.0123);
	parent = AddAnimationComponent (anim_arm_ep, 0, 1, rms_anim[2], parent);
	
	//RMS elbow camera
	static UINT RMSElbowCamGrp[2] = { GRP_ELBOW_CAM, GRP_PANTILT_ELBOW_CAM };
	MGROUP_ROTATE* pRMSElbowCamPan = new MGROUP_ROTATE(midx, RMSElbowCamGrp + 1, 1,
		_V(-2.54439, 0.145388, 0.15683), _V(0.397185, 0.917739, 0), (float)(340 * RAD));
	
	anim_camRMSElbow[PAN] = CreateAnimation(0.5);
	parent2 = AddAnimationComponent(anim_camRMSElbow[PAN], 0, 1, pRMSElbowCamPan, parent);

	MGROUP_ROTATE* pRMSElbowCamTilt = new MGROUP_ROTATE(midx, RMSElbowCamGrp, 1,
		_V(-2.46462, 0.343234, 0.15463), _V(0.917758, -0.397141, 0), (float)(340 * RAD));
	anim_camRMSElbow[TILT] =CreateAnimation(0.5);
	parent2 = AddAnimationComponent(anim_camRMSElbow[TILT], 0, 1, pRMSElbowCamTilt, parent2);
	
	MGROUP_ROTATE* pRMSElbowCamLoc = new MGROUP_ROTATE(LOCALVERTEXLIST, MAKEGROUPARRAY(camRMSElbowLoc), 3,
		_V(-2.37968, 0.296129, -0.0332794), _V(1, 0, 0), 0.0f);
	AddAnimationComponent(anim_camRMSElbow[TILT], 0, 1, pRMSElbowCamLoc, parent2);
	
	static UINT RMSWristPitchGrp[1] = { GRP_Wristpitch };
	rms_anim[3] = new MGROUP_ROTATE (midx, RMSWristPitchGrp, 1,
		_V(-2.60695 , 2.017606, - 4.637086), _V(1, 0, 0), (float)(242 * RAD)); // -120 .. +120
	anim_arm_wp = CreateAnimation (0.5);
	parent = AddAnimationComponent (anim_arm_wp, 0, 1, rms_anim[3], parent);
	
	static UINT RMSWristYawGrp[1] = { GRP_Wrist_Yaw };
	rms_anim[4] = new MGROUP_ROTATE (midx, RMSWristYawGrp, 1,
		_V(-2.60695,  1.883633, - 5.137431), _V(0, 1, 0), (float)(-242.6*RAD)); // -120 .. +120
	anim_arm_wy = CreateAnimation (0.5);
	parent = AddAnimationComponent (anim_arm_wy, 0, 1, rms_anim[4], parent);

	static UINT RMSEndEffectorGrp[1] = { GRP_Endeffector };
	rms_anim[5] = new MGROUP_ROTATE(midx, RMSEndEffectorGrp, 1,
		_V(-2.59965,  2.010648, - 6.343711), _V(0, 0, 1), (float)(894 * RAD));  // -447 .. +447
	anim_arm_wr = CreateAnimation(0.5);
	parent = AddAnimationComponent(anim_arm_wr, 0, 1, rms_anim[5], parent);
	
	rms_anim[6] = new MGROUP_ROTATE(LOCALVERTEXLIST, MAKEGROUPARRAY(arm_tip), 3,
		_V(-2.59965, 2.010648, -6.343711), _V(0, 0, 1), (float)(894 * RAD));  // -447 .. +447
	
	anim_rms_ee = CreateAnimation(0.5);
	AddAnimationComponent(anim_rms_ee, 0, 1, rms_anim[6] , parent);
	hAC_arm = AddAnimationComponent(anim_rms_ee, 0, 1, rms_anim[6], parent);
So not sure what this number red'3" should be?
Code:
rms_anim[6] = new MGROUP_ROTATE(LOCALVERTEXLIST, MAKEGROUPARRAY(arm_tip), 3,
		_V(-2.59965, 2.010648, -6.343711), _V(0, 0, 1), (float)(894 * RAD));
Then I have the anim rms ee follow the wrist animation state
Code:
lse if (SendDlgItemMessage (hWnd, IDC_WRIST_ROLLLEFT, BM_GETSTATE, 0, 0) & BST_PUSHED) {
				sts->arm_wr = max (0.0, sts->arm_wr - (t1-t0)*ARM_OPERATING_SPEED);
				sts->SetAnimationArm (sts->anim_arm_wr, sts->arm_wr);
				sts->arm_wr = max(0.0, sts->arm_wr - (t1 - t0)*ARM_OPERATING_SPEED);

				sts->SetAnimationArm(sts->anim_rms_ee, sts->arm_wr);
			} else if (SendDlgItemMessage (hWnd, IDC_WRIST_ROLLRIGHT, BM_GETSTATE, 0, 0) & BST_PUSHED) {
				sts->arm_wr = min (1.0, sts->arm_wr + (t1-t0)*ARM_OPERATING_SPEED);
				sts->SetAnimationArm (sts->anim_arm_wr, sts->arm_wr);
				sts->arm_wr = max(0.0, sts->arm_wr - (t1 - t0)*ARM_OPERATING_SPEED);

				sts->SetAnimationArm(sts->anim_rms_ee, sts->arm_wr);
gattispilot is offline   Reply With Quote
Old 02-20-2018, 03:16 PM   #49
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

so reading the API
Code:
Instead of adding mesh groups to an animation, it is also possible to add a
local VECTOR3 array. To do this, set “mesh” to LOCALVERTEXLIST, and
set “grp” to MAKEGROUPARRAY(vtxptr), where vtxptr is the VECTOR3
array. “ngrp” is set to the number of vertices in the array. Example:
VECTOR3 vtx[2] = {_V(0,0,0), _V(1,0,-1)};
MGROUP_TRANSFORM *mt = new MGROUP_TRANSFORM (LOCALVERTEXLIST,
MAKEGROUPARRAY(vtx), 2);
AddAnimationComponent (anim, 0, 1, mt);
Transforming local vertices in this way does not have an effect on the visual
appearance of the animation, but it can be used by the module to keep track
of a transformed point during animation. The Atlantis module uses this
method to track a grappled satellite during animation of the RMS arm.
So the red 3 in my code is the number of vertices, correct.

So are the vertices the joints? in a rms arm?
gattispilot is offline   Reply With Quote
Old 03-01-2018, 12:06 PM   #50
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

So the goal was to make more shuttles. I found that by just coding thew shuttle we can use ms2015 for launches. Then the user may select which srb, et,......

2 versions. #1 Columbia with "old" rms, no ODS
#2 Constellation with new RMs

Both have cameras and rms camera and lights.

But recently I noticed an BIG issue. either the cockpit or VC mesh gets shifted.



from this cockpit view you can see the window frame are no matching up.


I have switched the meshes and no change. I was thinking I moved them

Any ideas? As far as I have seen no shift mesh commands.

I have commented out all animations.

I added a remade shuttle and the same result.

---------- Post added 03-01-18 at 06:06 AM ---------- Previous post was 02-28-18 at 07:14 AM ----------

Not sure if this is a bug or not.
The default Atlantis is forward of the cockpit mesh. The vc is the highlighted mesh.


That why the bars are shown in the vc. I ran this in another Orbiter 2016 and the same. and confirm by another user.

Still no idea why the vc is extending into the shuttle bay.
gattispilot is offline   Reply With Quote
Old 03-01-2018, 07:33 PM   #51
Donamy
Beta Tester


Default

Can you turn of the VC mesh when you are displaying outside view ?
Donamy is offline   Reply With Quote
Old 03-02-2018, 12:59 PM   #52
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

Yes


and



Code:
hOrbiterMesh = oapiLoadMeshGlobal("Atlantis\\Atlantis");
	hOrbiterCockpitMesh = oapiLoadMeshGlobal("Atlantis\\AtlantisCockpit");
	hOrbiterVCMesh = oapiLoadMeshGlobal("Atlantis\\AtlantisVC");

	// Load meshes
	mesh_cockpit = AddMesh(hOrbiterCockpitMesh);
	SetMeshVisibilityMode(mesh_cockpit, MESHVIS_EXTERNAL);

	mesh_orbiter = AddMesh(hOrbiterMesh);
	SetMeshVisibilityMode(mesh_orbiter, MESHVIS_EXTERNAL | MESHVIS_VC | MESHVIS_EXTPASS);

	mesh_vc = AddMesh(hOrbiterVCMesh);
	SetMeshVisibilityMode(mesh_vc, MESHVIS_VC | MESHVIS_EXTERNAL);
gattispilot is offline   Reply With Quote
Old 03-02-2018, 02:12 PM   #53
Donamy
Beta Tester


Default

So, does that solve the problem ?
Donamy is offline   Reply With Quote
Old 03-02-2018, 11:34 PM   #54
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

No. The default Atlantis is like that.

---------- Post added at 05:34 PM ---------- Previous post was at 09:13 AM ----------

So if I do this. Then the vc doesn't come thru the cargobay.
Code:
	mesh_cockpit = AddMesh(hOrbiterCockpitMesh);
	SetMeshVisibilityMode(mesh_cockpit, MESHVIS_EXTERNAL);
	
	mesh_orbiter = AddMesh(hOrbiterMesh);
	SetMeshVisibilityMode(mesh_orbiter, MESHVIS_ALWAYS | MESHVIS_VC );

	mesh_vc = AddMesh(hOrbiterVCMesh);
	SetMeshVisibilityMode(mesh_vc, MESHVIS_ALWAYS | MESHVIS_VC );
But because the VC doesn't match the main mesh there are issues. So I main need to make the cockpit mesh which does fit the vc mesh also with the mfd,........
gattispilot is offline   Reply With Quote
Old 03-04-2018, 11:41 AM   #55
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

So I redid the vc. But there seems to be a vc-hires and a lo one. Not sure why?

Got the front mfd to work. Thinking about the aft one to make it on the aft wall.

The one function I can't get to work or see the difference was the mfd bright function
gattispilot is offline   Reply With Quote
Old 03-05-2018, 01:28 PM   #56
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

Ok last but not least

RMS dialogue box. I can add the store/recall boxes.

But not sure how to code them.

I think the save state is stored in the scn. Then when you press read you open the scn and get the values and then like stow it follows a set sequence
gattispilot is offline   Reply With Quote
Old 03-07-2018, 12:02 PM   #57
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

I have run into a major issue with the vc.

So the mfd and screen have the same texture "label.dds". The screen are id as cdr1,cdr2,....

But the labels for the mfd not.

So I get the cdr1 to work but the cdr2 screen shows but not the label,....

Code:
bool Atlantis::clbkLoadVC (int id)
{
	static VCHUDSPEC huds = {  // common HUD specs
		mesh_vc,            // nmesh
		GRP_VIRTUAL_HUD,  // ngroup
		{0,0,0},            // hudcnt (to be filled)
		0.176558            // size
	};
	//static VCMFDSPEC mfds = {
	//	mesh_vc, 0
	//};
	static EXTMFDSPEC mfds = { // common MFD specs
		{0,0,0,0},          // pos
		mesh_vc,            // nmesh
		0,                  // ngroup (to be filled)
		MFD_SHOWMODELABELS, // flag
		5, 0,               // nbt1, nbt2
		512/6, 512/7        // bt_yofs, bt_ydist
	};
	static const int mfdgrp[10] = {
		GRP_CDR1_VC,GRP_CDR2_VC,GRP_PLT1_VC,GRP_PLT2_VC,
		GRP_MFD1_VC, GRP_MFD2_VC, GRP_MFD3_VC, GRP_MFD4_VC, GRP_MFD5_VC,
		GRP_MFD_AFT_VC
	};

	bool ok = false;

	// register MFD function buttons
	// this needs to be done globally, so that the labels are correctly updated from all VC positions
	SURFHANDLE tex1 = oapiGetTextureHandle (hOrbiterVCMesh, 14);

	// commander MFD function buttons
	oapiVCRegisterArea (AID_CDR1_BUTTONS, _R(0,1,255,14), PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN|PANEL_MOUSE_LBUP|PANEL_MOUSE_LBPRESSED|PANEL_MOUSE_ONREPLAY, PANEL_MAP_BACKGROUND, tex1);
	oapiVCRegisterArea (AID_CDR2_BUTTONS, _R(0,15,255,28), PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN|PANEL_MOUSE_LBUP|PANEL_MOUSE_LBPRESSED|PANEL_MOUSE_ONREPLAY, PANEL_MAP_BACKGROUND, tex1);
	// pilot MFD function buttons
	oapiVCRegisterArea (AID_PLT1_BUTTONS, _R(0,29,255,42), PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN|PANEL_MOUSE_LBUP|PANEL_MOUSE_LBPRESSED|PANEL_MOUSE_ONREPLAY, PANEL_MAP_BACKGROUND, tex1);
	oapiVCRegisterArea (AID_PLT2_BUTTONS, _R(0,43,255,56), PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN|PANEL_MOUSE_LBUP|PANEL_MOUSE_LBPRESSED|PANEL_MOUSE_ONREPLAY, PANEL_MAP_BACKGROUND, tex1);
	// central console MFD function buttons
	oapiVCRegisterArea (AID_MFD1_BUTTONS, _R(0, 57,255, 70), PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN|PANEL_MOUSE_LBUP|PANEL_MOUSE_LBPRESSED|PANEL_MOUSE_ONREPLAY, PANEL_MAP_BACKGROUND, tex1);
	oapiVCRegisterArea (AID_MFD2_BUTTONS, _R(0, 71,255, 84), PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN|PANEL_MOUSE_LBUP|PANEL_MOUSE_LBPRESSED|PANEL_MOUSE_ONREPLAY, PANEL_MAP_BACKGROUND, tex1);
	oapiVCRegisterArea (AID_MFD3_BUTTONS, _R(0, 85,255, 98), PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN|PANEL_MOUSE_LBUP|PANEL_MOUSE_LBPRESSED|PANEL_MOUSE_ONREPLAY, PANEL_MAP_BACKGROUND, tex1);
	oapiVCRegisterArea (AID_MFD4_BUTTONS, _R(0, 99,255,112), PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN|PANEL_MOUSE_LBUP|PANEL_MOUSE_LBPRESSED|PANEL_MOUSE_ONREPLAY, PANEL_MAP_BACKGROUND, tex1);
	oapiVCRegisterArea (AID_MFD5_BUTTONS, _R(0,113,255,126), PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN|PANEL_MOUSE_LBUP|PANEL_MOUSE_LBPRESSED|PANEL_MOUSE_ONREPLAY, PANEL_MAP_BACKGROUND, tex1);
In my vc mesh labels is the 14th texture.
Code:
TEXTURES 14
Atlantis/R1L1.dds
Atlantis/c3.dds
Atlantis/A8top.dds
Atlantis/R2.dds
Atlantis/c2.dds
Atlantis/clocknums.dds
Atlantis/A8bottom.dds
Atlantis/STSVC01.dds
Atlantis/STSVC02.dds
Atlantis/STSVC03.dds
Atlantis/r13l.dds
Atlantis/talkback.dds
Atlantis/GPC.dds
Atlantis/label.dds D
So int he Atlantis mesh definition notice the mfd are in sequence
Code:
// Named mesh groups:
#define GRP_CDR1_VC 33
#define GRP_CDR2_VC 34
#define GRP_PLT1_VC 35
#define GRP_PLT2_VC 36
#define GRP_MFD1_VC 37
#define GRP_MFD2_VC 38
#define GRP_MFD3_VC 39
#define GRP_MFD4_VC 40
#define GRP_MFD5_VC 41
#define GRP_MFD_aft_VC 42
Then come the labels.

But might are not



Code:
#define GRP_mesh45 360
#define GRP_CDR1_VC 361
#define GRP_mesh46 362
#define GRP_CDR2_VC 363
#define GRP_mesh47 364
#define GRP_PLT1_VC 365
#define GRP_mesh48 366
#define GRP_PLT2_VC 367
#define GRP_mesh49 368
#define GRP_MFD1_VC 369
#define GRP_mesh50 370
#define GRP_MFD2_VC 371
#define GRP_mesh51 372
#define GRP_MFD3_VC 373
#define GRP_mesh52 374
#define GRP_MFD4_VC 375
#define GRP_mesh53 376
#define GRP_MFD5_VC 377
#define GRP_mesh54 378
#define GRP_MFD_AFT_VC 379
in my the label comes first. No ideas how to fix this with using notepad and move the mesh groups around?

---------- Post added 03-07-18 at 06:02 AM ---------- Previous post was 03-06-18 at 07:22 PM ----------

Fixed it. Just rearrange the groups. But got the left and right mfd to adjust the brightest. But can't get the center section to change. I am setting the vc touch arear in the right x,y area not so much about the z. I tried on the surface but it didn't work. The Atlantis looked like it was above the surface?
gattispilot is offline   Reply With Quote
Thanked by:
Old 03-11-2018, 01:14 PM   #58
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

So closer.

So if the ODS is present we want the eva hatch to open on the ODS not the shuttle

But I get a CTD when I try to open in.

Code:
static UINT extodsDoorGrp[2] = { 0,7};
	static MGROUP_ROTATE newextodsDoor(3, extodsDoorGrp, 2,	_V(0, -.9320414, 12.04634), _V(1, 0, 0), (float)(-120 * RAD));
	anim_extodsdoor = CreateAnimation(0);
	AddAnimationComponent(anim_extodsdoor, 0.0, 0.4632, &newextodsDoor);

The ODS is number 3 in the mesh order.

Code:
	hOrbiterMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\Columbia\\Columbia2016B");
	hOrbiterCockpitMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\Columbia\\ColumbiaCockpit");
	hOrbiterVCMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\Columbia\\ColumbiaVC5A");
	hOrbiterODSMesh = oapiLoadMeshGlobal("2016SPACESHUTTLE\\Columbia\\ODS");
So if I have this a ctd:
Code:
if (ODS_status = 1)SetMeshVisibilityMode(mesh_ODS, MESHVIS_ALWAYS);//ODS PRESENT SHOW MESH
	SetGearParameters (gear_proc);
	if (ODS_status==0)SetAnimation(anim_extdoor, EXT_proc);// ODS NOT PRESENT OPEN WALL HATCH
	if (ODS_status == 1)SetAnimation(anim_extodsdoor, EXT_proc);//ODS PRESENT OPEN ODS HATCH
and in the scn:
ODS 1
HATCH 1 1.0000


If i make the animation state 0.000 then no ctd
gattispilot is offline   Reply With Quote
Old 03-12-2018, 04:02 PM   #59
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

So now I have run into a ctd when I go to VC.

When I run the debugger i get a break at ddraw.dll
gattispilot is offline   Reply With Quote
Old 03-14-2018, 07:41 PM   #60
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

Getting closer. I have run into this. The bright/dim.

Code:
	// handle MFD brightness buttons
	case AID_CDR1_BRT:
	case AID_CDR2_BRT:
	case AID_PLT1_BRT:
	case AID_PLT2_BRT:
	case AID_MFD1_BRT:
	case AID_MFD2_BRT:
	case AID_MFD3_BRT: 
	case AID_MFD4_BRT: 
	case AID_MFD5_BRT:
	case AID_MFDA_BRT: {
		static double t0, brt0;
		static bool up;
		int mfd = id-AID_CDR1_BRT;
		if (event & PANEL_MOUSE_LBDOWN) {
			up = (p.x >= 0.5);
			t0 = oapiGetSysTime();
			brt0 = mfdbright[mfd];
		} else if (event & PANEL_MOUSE_LBPRESSED) {
			double dt = oapiGetSysTime()-t0;
			double brt, dbrt = dt * 0.2;
			if (up) brt = min (1.0, brt0 + dbrt);
			else    brt = max (0.25, brt0 - dbrt);
			mfdbright[mfd] = brt;
			if (vis) {
				MATERIAL mat;
				memset (&mat, 0, sizeof(MATERIAL));
				mat.emissive.r = mat.emissive.g = mat.emissive.b = (float)brt;
				mat.emissive.a = 1.0f;
				DEVMESHHANDLE hMesh = GetDevMesh (vis, mesh_vc);
				oapiSetMaterial (hMesh, 17+mfd, &mat);
			}
		}
		} return false;
So as I understand it it changes the material setting.

But all that changes is the labels not the actual display
gattispilot is offline   Reply With Quote
Thanked by:
Reply

  Orbiter-Forum > Orbiter Space Flight Simulator > Orbiter SDK


Thread Tools

Posting Rules
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Jump


All times are GMT. The time now is 10:37 PM.

Quick Links Need Help?


About Us | Rules & Guidelines | TOS Policy | Privacy Policy

Orbiter-Forum is hosted at Orbithangar.com
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Copyright 2007 - 2017, Orbiter-Forum.com. All rights reserved.