MeestR Posted May 21, 2016 Share Posted May 21, 2016 I'm trying to port the GetXYInFrontOfPlayer() function into the C++ SDK written by DK22Pac (here). What I've written seems to work sometimes, but sometimes gets left & right confused. If somebody could take a look at the code and give me some suggestions, it would be greatly appreciated! CVector GetXYInFrontOfPlayer(CPed* localPlayer, float distance) { CVector rVec = CVector(localPlayer->GetCoords()); float Rot = localPlayer->m_fCurrentRotation; rVec.x += (sinf(Rot) * distance); rVec.y += (cosf(Rot) * distance); return rVec;} Link to comment Share on other sites More sharing options...
DK22Pac Posted May 21, 2016 Share Posted May 21, 2016 Use TransformFromObjectSpace. CVector posn = ped->TransformFromObjectSpace(CVector(0.0f, 10.0f, 0.0f)); The_GTA 1 Link to comment Share on other sites More sharing options...
MeestR Posted May 21, 2016 Author Share Posted May 21, 2016 Use TransformFromObjectSpace. CVector posn = ped->TransformFromObjectSpace(CVector(0.0f, 10.0f, 0.0f)); Awesome! Thanks for that it works perfectly, didn't know it existed. Also I've been looking through some of your stuff but I can't seem to find a method for spawning new peds. Is there something I've missed? Link to comment Share on other sites More sharing options...
DK22Pac Posted May 21, 2016 Share Posted May 21, 2016 No, no functionality for this yet. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now