Raised This Month: $12 Target: $400
 3% 

[CSGO] Prop angels rotation


Post New Thread Reply   
 
Thread Tools Display Modes
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
Mitchell
~lick~
Join Date: Mar 2010
Old 07-18-2018 , 08:57   Re: [CSGO] Prop angels rotation
Reply With Quote #2

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.
Mitchell is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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