SourceOP
e_wheel source code - Printable Version

+- SourceOP (http://forums.sourceop.com)
+-- Forum: SourceOP Plugin (http://forums.sourceop.com/SourceOP-Plugin-forum)
+--- Forum: General Chat (http://forums.sourceop.com/General-Chat-forum)
+--- Thread: e_wheel source code (/e-wheel-source-code-thread)



e_wheel source code - Naruto - Jun 23, 2011

Hi Drunken_F00l, can you post fix angles process on "models/props_wasteland/wheel02a.mdl" in e_wheel source code?

i want fix that angles, but i dont know how to do. :?:


e_wheel source code - Drunken F00l - Jun 23, 2011

I'm pretty sure it's all here:
http://www.sourceop.com/modules.php?name=Forums&file=viewtopic&t=25312


e_wheel source code - Naruto - Jun 24, 2011

how can i fix it with sourcemod :?

matrix function didn't included in sourcemod :roll:

here is my code:
Code:
if(Build_RegisterEntityOwner(Client, wheelIndex)) {
    new Float:hitPos[3];
    new Float:hitNormal[3];
    TR_GetEndPosition(hitPos, trace);
    TR_GetPlaneNormal(trace, hitNormal);
                    
    GetArrayString(g_hWheelModelPathArray, IndexInArray, szModelPath, sizeof(szModelPath));
                    
    if(!IsModelPrecached(szModelPath))
        PrecacheModel(szModelPath);
                    
    DispatchKeyValue(wheelIndex, "model", szModelPath);
    DispatchKeyValue(wheelIndex, "spawnflags", "256");
    DispatchKeyValueFloat(wheelIndex, "physdamagescale", 0.0);
    DispatchKeyValueFloat(wheelIndex, "ExplodeDamage", 0.0);
    DispatchKeyValueFloat(wheelIndex, "ExplodeRadius", 0.0);
                    
    DispatchSpawn(wheelIndex);
    ActivateEntity(wheelIndex);
                    
    new Float:surfaceAng[3];                    
    GetVectorAngles(hitNormal, surfaceAng);
                    
    new Float:wheelCenter[3]; // Should be calculating the width of the model for this.
    new Float:vecToAdd[3];
                    
    vecToAdd[0] = hitNormal[0];
    vecToAdd[1] = hitNormal[1];
    vecToAdd[2] = hitNormal[2];
                    
    switch(StringToInt(szWheelName)) {
        case 1:
            ScaleVector(vecToAdd, 5.0);
        case 2:
            ScaleVector(vecToAdd, 10.0);
        case 3:
            ScaleVector(vecToAdd, 7.5);
        case 4:
            ScaleVector(vecToAdd, 12.5);
        case 5:
            ScaleVector(vecToAdd, 11.0);
        case 6:
            ScaleVector(vecToAdd, 40.0);
        case 7:
            ScaleVector(vecToAdd, 40.0);
    }
    
    AddVectors(hitPos, vecToAdd, wheelCenter);
    TeleportEntity(wheelIndex, wheelCenter, surfaceAng, NULL_VECTOR);
                    
    Phys_CreateHingeConstraint(entIndex, wheelIndex, INVALID_HANDLE, hitPos, hitNormal);
    Build_PrintToChat(Client, "Added wheel to target");
}



e_wheel source code - Drunken F00l - Jun 24, 2011

Oh, I don't know if sourcemod has matrix math functions. You'll have to check with them. If not, you could write your own by converting the ones you need from the SDK.