- Joined
- Jun 6, 2012
- Messages
- 283
- Reaction score
- 65
- Points
- 28
- Location
- Sydney, Australia, Earth, Sol
- Website
- www.orbithangar.com
Hi All,
I am creating a vessel which will jettison a component. This is simple enough, however I would like the spawned vessel to be rotated 90 degrees relative to the parent vessel. This is something I have always struggled to achieve, my guess is that I am improperly converting between relative/local/global.
If someone knows how to do this any advice would be appreciated. For reference, I have this in my code to create a vessel:
I tried adding the following, but found that the created vessel was just rotated randomly. I have played around with all of the coordinate transformations in the VesselAPI to no avail:
Has anyone managed to achieve what I am trying to? I would love to know if anyone knows how to do this, it's driving me crazy
Thank you!
I am creating a vessel which will jettison a component. This is simple enough, however I would like the spawned vessel to be rotated 90 degrees relative to the parent vessel. This is something I have always struggled to achieve, my guess is that I am improperly converting between relative/local/global.
If someone knows how to do this any advice would be appreciated. For reference, I have this in my code to create a vessel:
C++:
void Ship::Jettison (char* classname, char* ext, VECTOR3 ofs, VECTOR3 dir)
{
VESSELSTATUS vs;
char name[255];
VECTOR3 rofs;
double vel = 0.2;
GetStatus(vs);
Local2Rel (ofs, vs.rpos);
GlobalRot (dir, rofs);
vs.rvel += rofs*vel;
strcpy (name, GetName()); strcat (name, ext);
oapiCreateVessel (name, classname, vs);
}
I tried adding the following, but found that the created vessel was just rotated randomly. I have played around with all of the coordinate transformations in the VesselAPI to no avail:
C++:
VECTOR3 rot = {0, 1, 0};
VECTOR3 rrot;
GlobalRot (rot, rrot);
vs.arot = rot;
Has anyone managed to achieve what I am trying to? I would love to know if anyone knows how to do this, it's driving me crazy
Thank you!