Raised This Month: $ Target: $400
 0% 

How to drag entity toward us?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
qwerty123
Junior Member
Join Date: May 2011
Old 05-02-2012 , 07:11   How to drag entity toward us?
Reply With Quote #1

As the tittle said, how can I make the entity to come ( drag ) toward us?
qwerty123 is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-02-2012 , 09:29   Re: How to drag entity toward us?
Reply With Quote #2

Code:
stock VelocityFromAtoB(const Float:originA[3], const Float:originB[3], const Float:speed, Float:output[3]) {     output[0] = originB[0] - originA[0];     output[1] = originB[1] - originA[1];     output[2] = originB[2] - originA[2];         new Float:length = vector_length(output);         output[0] *= (speed / length);     output[1] *= (speed / length);     output[2] *= (speed / length); }

Then you can use it like this:
Code:
new Float:playerOrigin[3], Float:entityOrigin[3]; entity_get_vector(id, EV_VEC_origin, playerOrigin); entity_get_vector(ent, EV_VEC_origin, entityOrigin); new Float:speed = 300.0; // units per second new Float:velocity[3]; VelocityFromAtoB(entityOrigin, playerOrigin, speed, velocity); entity_set_vector(ent, EV_VEC_velocity, velocity);
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!

Last edited by Exolent[jNr]; 05-02-2012 at 09:29.
Exolent[jNr] is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 05-02-2012 , 10:06   Re: How to drag entity toward us?
Reply With Quote #3

looking for this?

http://forums.alliedmods.net/showthread.php?p=541795
Liverwiz 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 07:47.


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