AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   [CSGO] Prop angels rotation (https://forums.alliedmods.net/showthread.php?t=309226)

Kailo 07-18-2018 07:40

[CSGO] Prop angels rotation
 
Goal: Spawn "models/weapons/w_eq_sensorgrenade.mdl" with correct rotaion for surface.

If just spawn with default rotation

My environment has next parameters:
PHP Code:

methodmap System
{
    public static 
int Place(const float pos[3], const float normal[3])
    {
        
PrintToChatAll("{%.2f, %.2f, %.2f}"normal[0], normal[1], normal[2]);
        
float origin[3], ang[3], vec[3];
        
vec normal// this is for get angle by normal without rotation
        //GetVectorVectors(normal, vec, NULL_VECTOR); // this is for get angle by normal with rotation
        
GetVectorAngles(vecang);
        
        
origin pos;
        
// this is offsets for place model like red glass will in point of spawn
        // if not rotate it
        //origin[0] += 5.0;
        //origin[1] -= 1.0;
        //origin[2] -= 2.75;
        
        
float posx[3], posy[3], posz[3];
        
GetAngleVectors(angposxposyposz);
        
ScaleVector(posx8.0);
        
ScaleVector(posy8.0);
        
ScaleVector(posz8.0);
        
AddVectors(posposxposx);
        
AddVectors(posposyposy);
        
AddVectors(posposzposz);
        
DrawObject draw DrawObject();
        
draw.AddLine(posposx, {25500255});
        
draw.AddLine(posposy, {02550255});
        
draw.AddLine(posposz, {00255255});
        
        return 
UTILS.CreatePropDynamic("models/weapons/w_eq_sensorgrenade.mdl"originang);
    }


If i get normal vector angels and set it for model

Next i tried to get right vector for normal

It's work ok for walls but not for floor.
Probably i needed to rotate it along the Z axis for 90 degrees,
Or maybe you know better way to do what i want.

Mitchell 07-18-2018 08:57

Re: [CSGO] Prop angels rotation
 
No what you said is correct, you'll want to add to the normal the offset of the model you want to rotate. Since every model is different this part of the rotation will be different also. Theres probably some kind of snippet within the various trip mine plugins out there.


All times are GMT -4. The time now is 02:04.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.