Raised This Month: $32 Target: $400
 8% 

Solved [ H3LP ] Rotate angle vector


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 06-20-2018 , 18:05   [ H3LP ] Rotate angle vector
Reply With Quote #1

Hello, I want to set view angle in player relative to wall angle. I tried with GL_trace_plane_normal, it's working but not as an I want. I want to aim in wall direction, not in oposite direction of wall. How I can rotate this vector to opositional direction?

Code:
new Float:vPlane[3], Float:vAngles[3]; get_global_vector(GL_trace_plane_normal, vPlane); vector_to_angle(vPlane, vAngles); set_entvar(this, var_v_angle, vAngles); set_entvar(this, var_fixangle, 1);
__________________









Last edited by CrazY.; 06-21-2018 at 09:29.
CrazY. is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 06-20-2018 , 21:08   Re: [ H3LP ] Rotate angle vector
Reply With Quote #2

Basically what I need is to rotate the yaw (vAngles[1]). So if the wall is located at 90 °, the aim is being set to 270 °, I want to set the aim in 90 °.

Code:
Wall 	| Aim	 	| Aim that I want
--------------------------------------
90 ° 	| 270 ° 	| 90 °
270 ° 	| 90 ° 		| 270 °
180 ° 	| 360 ° 	| 180 °
360 ° 	| 180 ° 	| 360 °


Sorry for bump.
__________________









Last edited by CrazY.; 06-20-2018 at 21:27.
CrazY. is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 06-21-2018 , 02:37   Re: [ H3LP ] Rotate angle vector
Reply With Quote #3

PHP Code:
get_tr2(traceTR_flFractionfraction)
    
// If we didn't hit anything, then we won't get a valid TR_vecPlaneNormal.
    
if (fraction == 1.0) return
    
    new 
Float:normal[3]
    
get_tr2(traceTR_vecPlaneNormalnormal)
    
// We'll multiply the the normal vector by a scalar to make it longer.
    
normal[0] *= 400.0 // Mathematically, we multiplied the length of the vector by 400*(3)^(1/2),
    
normal[1] *= 400.0 // or, in words, four hundred times root three.
    
normal[2] *= 400.0 
You might get false result because you are not checking if the trace hit something transfer the vector into angles and it should give you the angles of the wall.

If i am wrong can you explain more of what are you doing?
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 06-21-2018 , 09:16   Re: [ H3LP ] Rotate angle vector
Reply With Quote #4

I'm trying to make a wall climb with "stuck". So basically, the player don't need to keep pressing IN_USE to climb. That's already working, but I need to EV_INT_fixangle/pev_fixangle in the player in the wall direction, so I don't need trace, only the plane.

So if I climb the wall that is in my front, the camera should keep aiming in this wall.
Spoiler


But what's really happening is the camera is being set to backward.
Spoiler


I hope you understand. If not I can show the code or enable the plugin in a test server.
__________________








CrazY. is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 06-21-2018 , 09:24   Re: [ H3LP ] Rotate angle vector
Reply With Quote #5

So it's always the opposite? Then just negate the direction vector before converting to angles.
Code:
xs_vec_neg(vPlane, vPlane);
__________________
klippy is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 06-21-2018 , 09:29   Re: [ H3LP ] Rotate angle vector
Reply With Quote #6

Works just fine, thanks.
__________________








CrazY. is offline
Reply



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:13.


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