The current RWarp implementation of directional warp supports X and Y only. The following uses the character camera angle and calculates for X, Y and Z accordingly using the polar equation of a sphere.
I wrote this for my own warp plugin a few months ago, but I've gotten lazy lately and unless I want to do something special, I find myself using the posted compiles. If someone could throw this into a compile from now on, that would be great.
Replace:
with the following:
I wrote this for my own warp plugin a few months ago, but I've gotten lazy lately and unless I want to do something special, I find myself using the posted compiles. If someone could throw this into a compile from now on, that would be great.
Replace:
Rich (BB code):
FLOAT angle = (FLOAT)((pChar->Heading)*0.0123);
FLOAT dissafegoto = (FLOAT)atof(Y);
DoWarp(pChar->Y + (FLOAT)(dissafegoto * cos(angle)), pChar->X + (FLOAT)(dissafegoto * sin(angle)), pChar->Z);
with the following:
Rich (BB code):
double Heading=pChar->Heading/(256/PI);
double CameraAngle=pChar->CameraAngle/(256/PI);
float posX=(float)(atof(Y)*sin(Heading)*cos(CameraAngle)+pChar->X);
float posY=(float)(atof(Y)*cos(Heading)*cos(CameraAngle)+pChar->Y);
float posZ=(float)(atof(Y)*sin(CameraAngle)+pChar->Z);
DoWarp(posY, posX, posZ);



