Oh, so you're leeching now
Add credits in the post.
i wanted to share the 2d radar
Usage :Code:FVector2D WorldToRadar( FVector Location , FLOAT PosX, FLOAT PosY , INT Size ) { /*Credits to ********* community | xCyniu | r4z8r when you use this ;)*/ FVector2D Coord; FVector2D Return; FLOAT cY = cos(URotationToRadians( MyCameraRotation.Yaw )); FLOAT sY = sin(URotationToRadians( MyCameraRotation.Yaw )); FLOAT dX = Location.X - MyCameraLocation.X; FLOAT dY = Location.Y - MyCameraLocation.Y; Coord.X = ( dY * cY - dX * sY ) / 150.0f; Coord.Y = ( dX * cY + dY * sY ) / 150.0f; Return.X = Coord.X + PosX + (Size / 2.0f); Return.Y = -Coord.Y + PosY + (Size / 2.0f); /*Thanks to r4z8r for clamp :)*/ if(Return.X > (PosX + Size) ) Return.X = (PosX + Size); else if(Return.X < (PosX) ) Return.X = PosX; if(Return.Y > (PosY + Size) ) Return.Y = (PosY + Size); else if(Return.Y < (PosY) ) Return.Y = PosY; return Return; }
Thanks to R4z8r for clamp function.Code:FVector2D Position = WorldToRadar(Target->Location, cVars.Radar.PosX, cVars.Radar.PosY,150);
P.S Size is the size of the radar : example : width = 150 , height = 150
Credits by xCyniu
Last edited by McFloMaster; 10-20-2011 at 04:55 AM.
I need defines of red marked words. Can any1 help?Code:FVector WorldToScreen (UCanvas* Canvas, FVector WorldLocation)//Helios { FVector X,Y,Z,D,Out; GetAxes(MyCameraRotation,X,Y,Z); D = WorldLocation - MyCameraLocation; Out.X = (Canvas->ClipX/2)+( Dot(D,Y))*((Canvas->ClipX/2)/tan(Me->FovAngle*PI/360))/Dot(D,X); Out.Y = (Canvas->ClipY/2)+(-Dot(D,Z))*((Canvas->ClipX/2)/tan(Me->FovAngle*PI/360))/Dot(D,X); Out.Z = 0; return Out; }
DOT:
Camera's:Code:FLOAT VectorDotProduct( FVector* pV1, FVector* pV2 ) { return ( ( pV1->X * pV2->X ) + ( pV1->Y * pV2->Y ) + ( pV1->Z * pV2->Z ) ); }
Code:FVector CameraLocation = FVector(); FRotator CameraRotation = FRotator();
Last edited by XvenDeR; 11-09-2011 at 02:21 PM.