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

Launch a smoke grenade 2.5 degrees to my right


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
eyal282
Veteran Member
Join Date: Aug 2011
Old 11-17-2019 , 06:02   Launch a smoke grenade 2.5 degrees to my right
Reply With Quote #1

Works, unless I look straight up, in which the grenade is fired 0.0 degrees to my right

Code:
		new Float:EyePosition[3], Float:EyeAngles[3];
	
		new grenade = CreateEntityByName("smokegrenade_projectile");
		
		GetClientEyePosition(client, EyePosition);
			
		GetClientEyeAngles(client, EyeAngles);
		
		EyeAngles[1] += 2.5;

		new Float:Velocity[3]; // Determine velocity based on given speed/angle
		GetAngleVectors(EyeAngles, Velocity, NULL_VECTOR, NULL_VECTOR);
		
		ScaleVector(Velocity, 800.0); 
		
		GetVectorAngles(Velocity, EyeAngles); // This variable won't be used again so we can steal it for this operation
		
		EyeAngles[0] += 90.0;
		
		TeleportEntity(grenade, EyePosition, EyeAngles, Velocity);
		
		//SetEntPropVector(grenade, Prop_Data, "m_angRotation", EyeAngles);
		
		DispatchSpawn(grenade);
		
		ActivateEntity(grenade);
		
		SetEntPropEnt(grenade, Prop_Send, "m_hThrower", client);
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 11-21-2019 , 14:25   Re: Launch a smoke grenade 2.5 degrees to my right
Reply With Quote #2

I've been experimenting with right vectors and up vectors. How would I be able to merge them into a forward vector after altering one or both of them?
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
mrmatthew2k
Junior Member
Join Date: Jun 2015
Old 11-24-2019 , 02:04   Re: Launch a smoke grenade 2.5 degrees to my right
Reply With Quote #3

Not exactly sure what you're describing. I also am not familiar with conventions of csgo's vectors. But keep in mind that the radius about the z axis is small when looking straight up. So it makes sense that the trajectory is the same. Also keep in mind some angle restrictions: the angle between the x-y plane and z axis only ranges from -90 to 90.

Code:
EyeAngles[0] += 90.0;
Quote:
I've been experimenting with right vectors and up vectors. How would I be able to merge them into a forward vector after altering one or both of them?
Not sure what you mean by this, but you can add the vectors part by part using
Code:
void AddVectors(const float vec1[3], const float vec2[3], float result[3])

Last edited by mrmatthew2k; 11-24-2019 at 02:05.
mrmatthew2k 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 00:31.


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