View Single Post
LostMind
New Member
Join Date: Mar 2020
Old 04-05-2020 , 09:41   Re: Calculate velocity to point X
Reply With Quote #4

Quote:
Originally Posted by HamletEagle View Post
destOrigin - sourceOrigin + normalize + multiply by speed.

P.S: force and velocity are 2 different things.
Hi, so i wanted to say that i requested doni to post this for me and maybe i would get some help.
But we didn't solve this problem.
Code:
					new Float:fPlayerOrigin[3], iAimOrigin[3], Float:fAngle[ 3 ];
					get_user_origin( id, iAimOrigin, 3 );
					
					pev( id, pev_origin, fPlayerOrigin );
					pev( id, pev_angles, fAngle );
					
					new iEnt = create_entity( "info_target" );
					
					entity_set_string( iEnt, EV_SZ_classname, "_entity" );
					entity_set_model( iEnt, spit_model );
					entity_set_size( iEnt, Float:{ -1.5, -1.5, -1.5 }, Float:{ 1.5, 1.5, 1.5 } );
					entity_set_origin( iEnt, fPlayerOrigin );
					entity_set_vector( iEnt, EV_VEC_angles, fAngle );
					entity_set_int( iEnt, EV_INT_solid, 2 );
					entity_set_int( iEnt, EV_INT_rendermode, 5 );
					entity_set_float( iEnt, EV_FL_renderamt, 200.0 );
					entity_set_float( iEnt, EV_FL_scale, 1.00 );
					entity_set_int( iEnt, EV_INT_movetype, MOVETYPE_TOSS );
					entity_set_float(iEnt, EV_FL_gravity, 1.0)
					entity_set_edict( iEnt, EV_ENT_owner, id );
					
					iAimOrigin[ 0 ] -= fPlayerOrigin[ 0 ];
					iAimOrigin[ 1 ] -= fPlayerOrigin[ 1 ];
					iAimOrigin[ 2 ] -= fPlayerOrigin[ 2 ];
					
					new Float:fNormalizedVec[ 3 ], Float:fFinalVec[ 3 ];
					xs_vec_normalize( Float:iAimOrigin, fNormalizedVec );
					xs_vec_mul_scalar( fNormalizedVec, float(pev( iEnt, pev_maxspeed )), fFinalVec )
Here it is the code. If you have time. Can you see where is the problem? And also, the entity goes down only.

Last edited by LostMind; 04-05-2020 at 09:42.
LostMind is offline