Rules FAQ Members List Search Register Login

 Raised This Month: \$204 Target: \$400 51%

Author Message
MomemtumMori
SourceMod Donor
Join Date: Oct 2009
 08-12-2010 , 22:23   NegateVector() broken? #1 I need to reverse a vector. So i tought using stock NegateVector(Float:vec[3]) but it doesnt change the value at all! i even tryed doing it manually. camAngle2[0] = -clientCamAngle[0]; camAngle2[1] = -clientCamAngle[1]; camAngle2[2] = -clientCamAngle[2]; and i got the same result. Help please?
javalia
Senior Member
Join Date: May 2009
Location: korea, republic of
 08-13-2010 , 01:11   Re: NegateVector() broken? #2 negativing a vector means reverse vector`s "direction". so vector`s "length" will not be changed. only direction will be changed.
javalia
Senior Member
Join Date: May 2009
Location: korea, republic of
 08-13-2010 , 01:15   Re: NegateVector() broken? #3 if u are really want to see change, just convert that reversed and original vectors to angle and print it. than u will able to see vectors in angle is different
MomemtumMori
SourceMod Donor
Join Date: Oct 2009
 08-13-2010 , 19:22   Re: NegateVector() broken? #4 ok. but thats already an angle vector from MakeVectorFromPoints(point1, point2, vecResult); GetVectorAngles(vecResult, clientCamAngle); and that makes the player look in the exact opposite direction. I dont see the point into converting an angle vec to another angle vector.. but ill try anyway. EDIT Heres the result point1 : 5553.742187 5676.272460 -799.968750 point2 : 5339.999511 6338.448730 -807.968750 vecResult: -213.742675 662.176269 -8.000000 clientCamAngle : 0.658714 107.889465 0.000000 negate() clientCamAngle : 0.658714 107.889465 0.000000 angles() clientCamAngle : 0.000000 89.918075 0.000000 last line is always the same or sometime changes to : 0.000000 90.0000000.000000 no matter what direction im aiming Last edited by MomemtumMori; 08-13-2010 at 19:46. Reason: Testing
javalia
Senior Member
Join Date: May 2009
Location: korea, republic of
 08-14-2010 , 00:14   Re: NegateVector() broken? #5 MakeVectorFromPoints(point1, point2, vecResult); GetVectorAngles(vecResult, clientCamAngle); vecresult is direction vector. yes, it is vector. but, clientcamangle is not vector. it is angle value. like 0˚ ~ 360˚ from it is not vector, u will get incorrect result from reversing that vector. and if u want to get reversed direction of client view angle, just get client eye angle and change it onto vector(u must use vector from first vector buffer of that fucntion) and negate that vector and transfrom it to angle.
MomemtumMori
SourceMod Donor
Join Date: Oct 2009
 08-14-2010 , 11:35   Re: NegateVector() broken? #6 im confused <_> I tryed to do that based on your explanation PHP Code: ```     new Float:vecResult[3];    MakeVectorFromPoints(point1, point2, vecResult);        new Float:clientAngles[3];    GetVectorAngles(vecResult, clientAngles);        new Float:clientAngleVector[3];    GetAngleVectors(clientAngles, clientAngleVector, NULL_VECTOR, NULL_VECTOR);    NegateVector(clientAngleVector);        GetVectorAngles(clientAngleVector, clientAngles);        TeleportEntity(client, NULL_VECTOR, clientAngles, NULL_VECTOR);  ``` but its still not pointing in the right direction
javalia
Senior Member
Join Date: May 2009
Location: korea, republic of
 08-14-2010 , 11:45   Re: NegateVector() broken? #7 no not that. if u want to just get reversed vector of client eye view, - pseudocode decl clienteyeangle getclienteyeangle(client, clienteyeangle) decl vector1 getvectorfromangle(clienteyeangle, vector1, null, null) negatevector(vector1) teleportclient(vector1)
javalia
Senior Member
Join Date: May 2009
Location: korea, republic of
 08-14-2010 , 11:50   Re: NegateVector() broken? #8 more edit : u are want to change angle of client, if so just do this - pseudocode negatevector(vector1) teleportclient(null, vectortoangle(vector1) null)
javalia
Senior Member
Join Date: May 2009
Location: korea, republic of
 08-14-2010 , 11:51   Re: NegateVector() broken? #9 hm...my pseudo code is suck. i should not use it more lol
Damizean
SourceMod Donor
Join Date: Mar 2009
 08-14-2010 , 11:53   Re: NegateVector() broken? #10 Your issue is that the - unary operator doesn't work with floats, I came across that issue recently, so your code would need to be: PHP Code: ``` VecNegated[0] = 0.0 - Vec[0];VecNegated[1] = 0.0 - Vec[1];VecNegated[2] = 0.0 - Vec[2];  ``` __________________ Dat annoying guy

 Thread Tools Display Modes Linear Mode

 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 Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Server Discussion     Source Servers (SRCDS)     HL1 Servers (HLDS) AMX Mod X     News     Bug Reports     General     Off-Topic     Plugins         Suggestions / Requests         Approved Plugins         New Plugin Submissions         Unapproved/Old Plugins         Translation Request         High-Traffic Plugins             GunGame             UAIO (Ultimate All-In-One Plugin)             xREDIRECT             CSDM             AMX Super             RuneMod             Zombie Plague Mod             SuperHero Mod                 News                 Tech Support                 Scripting Help                 Off-Topic / General Chat                 Heroes                     Suggestions / Requests                     Approved Heroes                     New Submissions                     Unapproved/Old Heroes                         Module Heroes                     SuperHero Mod Stats - By 123                 (OLD) Bug Reports     Scripting         Scripting Help         Code Snippets/Tutorials         Module Coding     Donor Access SourceMod     News     General     Plugins         Plugins         Unapproved Plugins         Plugin/Gameplay Ideas and Requests         High-Traffic Plugins             SourceMod Anti-Cheat             Zombie:Reloaded             SourceBans / SourceBans++             VSH / Freak Fortress             Store             SM_Hosties             HLstatsX:CE     Scripting     Extensions     Snippets and Tutorials     Donor Access     Metamod: Source         Metamod:Source Plugins         Metamod:Source Questions         Coding MM:S Plugins & SM Extensions Hosted Stuff     Asherkin's Plugins         TF2Items         TFDodgeball         SteamTools     Bail's Plugins         CSDM         CS:S DM Off-Topic & Trash     Off-Topic     Trash

All times are GMT -4. The time now is 22:56.

 DMCA - Archive - Top