Raised This Month: $ Target: $400
 0% 

[solved]: adding vectors to each other and multipling vectors by integer


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Owyn
Veteran Member
Join Date: Nov 2007
Old 08-14-2011 , 05:57   [solved]: adding vectors to each other and multipling vectors by integer
Reply With Quote #1

hi, i need to get 30 units forward of player aiming origin,

trying to convert
PHP Code:
AMX_NATIVE_CALL get_user_aiming 
to AMXX but this part got me confused:
PHP Code:
Vector v_dest v_src v_forward static_cast<float>(params[4]); 
so it would be
PHP Code:
new Float:v_dest[3] = v_src v_forward 30// Float[3] = float[3] + float[3] * integer 
but that doesn't work in AMXX, what should i write in amxx to get simular calculations?
__________________
☜ Free Mozy ☂backup\҉sync user
Quote:
Американский форум - Задаёшь вопрос, потом тебе отвечают.
Израильский форум - Задаёшь вопрос, потом тебе задают вопрос.
Русский форум - Задаёшь вопрос, потом тебе долго рассказывают, какой ты мудак.

Last edited by Owyn; 08-14-2011 at 06:00.
Owyn is offline
Send a message via ICQ to Owyn
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-14-2011 , 06:17   Re: how: adding vectors to each other and multipling vectors by integer
Reply With Quote #2

You just do it piece by piece:

PHP Code:
new Float:v_dest[3]
v_dest[0] = v_src[0] + v_forward[0] * 30.0
v_dest
[1] = v_src[1] + v_forward[1] * 30.0
v_dest
[2] = v_src[2] + v_forward[2] * 30.0 
__________________
fysiks is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-14-2011 , 06:18   Re: how: adding vectors to each other and multipling vectors by integer
Reply With Quote #3

Use xs stocks

xs_vec_add xs_vec_scalar etc..
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-14-2011 , 06:21   Re: how: adding vectors to each other and multipling vectors by integer
Reply With Quote #4

Quote:
Originally Posted by ConnorMcLeod View Post
Use xs stocks

xs_vec_add xs_vec_scalar etc..
xs_vec_mul_scalar
__________________
fysiks is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-14-2011 , 06:23   Re: how: adding vectors to each other and multipling vectors by integer
Reply With Quote #5

W/E, he has to open xs.inc to have an idea about avalaible stocks
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
abdul-rehman
Veteran Member
Join Date: Jan 2010
Location: Khi, Pakistan
Old 08-14-2011 , 06:50   Re: how: adding vectors to each other and multipling vectors by integer
Reply With Quote #6

you can try this:
Code:
stock get_user_aim_vector(id, vector_multiplier, Float:aim_vector[3]) {     static Float:angles[3]     pev(id, pev_v_angle, angles)         static Float:path[3]     angle_vector(angles, ANGLEVECTOR_FORWARD, path)     xs_vec_normalize(path, path)     xs_vec_mul_scalar(path, vector_multiplier, aim_vector) }
__________________

My Plugins For ZP

Inactive due to College and Studies
abdul-rehman is offline
Send a message via Yahoo to abdul-rehman Send a message via Skype™ to abdul-rehman
Owyn
Veteran Member
Join Date: Nov 2007
Old 08-14-2011 , 06:54   Re: how: adding vectors to each other and multipling vectors by integer
Reply With Quote #7

fysiks, thought about that but wasn't sure, thx
__________________
☜ Free Mozy ☂backup\҉sync user
Quote:
Американский форум - Задаёшь вопрос, потом тебе отвечают.
Израильский форум - Задаёшь вопрос, потом тебе задают вопрос.
Русский форум - Задаёшь вопрос, потом тебе долго рассказывают, какой ты мудак.

Last edited by Owyn; 08-14-2011 at 07:05.
Owyn is offline
Send a message via ICQ to Owyn
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 03:22.


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