View Single Post
Author Message
Kailo
Senior Member
Join Date: Sep 2014
Location: Moscow, Russia
Old 07-18-2018 , 07:40   [CSGO] Prop angels rotation
Reply With Quote #1

Goal: Spawn "models/weapons/w_eq_sensorgrenade.mdl" with correct rotaion for surface.
model

If just spawn with default rotation
without any 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
with normal rotation

Next i tried to get right vector for normal
with normal-right rotation

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.

Last edited by Kailo; 07-18-2018 at 07:42.
Kailo is offline