Raised This Month: $ Target: $400
 0% 

Entity Moving Help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ced
Member
Join Date: Oct 2004
Old 01-14-2005 , 17:33   Entity Moving Help
Reply With Quote #1

Could someone plz explain to me how exactly you could make a entity move at a constant speed from one location to another? I know how to spawn the entity, and all that, but how do you make it fly to that destination?
Ced is offline
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 01-14-2005 , 18:35  
Reply With Quote #2

Give it a velocity

It's a vector, look in engine_const
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
Ced
Member
Join Date: Oct 2004
Old 01-14-2005 , 19:06  
Reply With Quote #3

hmm, never thought it would be that simple. All that is needed is a set velocity in a direction and it will continue to fly in that direction?
Ced is offline
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 01-15-2005 , 09:51  
Reply With Quote #4

Until its friction settng stops it, or gravity, I assume.
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
Ced
Member
Join Date: Oct 2004
Old 01-15-2005 , 15:55  
Reply With Quote #5

How could i get a velocity to set the entity with if the angles are from another entity? Like, does anyone know what format the velocity should be in, i know it is Float:velocity[3] but what do the 3 values need to look like? Does the velocity have anything to do with which way the entity goes or is that angle entirely?
Ced is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 01-15-2005 , 17:26  
Reply With Quote #6

As the angles vector represents a certain rotation on a certain axis (X, Y, or Z), the velocity vector represents speeds in a certain direction (X, Y, Z).
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Ced
Member
Join Date: Oct 2004
Old 01-15-2005 , 18:15  
Reply With Quote #7

so i could just set the velocity[0] to something in order for it to go in a straight horizontal line?
Ced is offline
Ced
Member
Join Date: Oct 2004
Old 01-15-2005 , 19:27  
Reply With Quote #8

I see what you mean now, thank you everyone for your help. I still can't figure out how to calculate a velocity that goes from 1 origin to another. Any great math people know a formula to do this?
Ced is offline
BlueRaja
Senior Member
Join Date: Nov 2004
Old 01-16-2005 , 05:34  
Reply With Quote #9

Quote:
Originally Posted by Ced
I see what you mean now, thank you everyone for your help. I still can't figure out how to calculate a velocity that goes from 1 origin to another. Any great math people know a formula to do this?
uh...velocity is a vector
soooo
velocity.x=(origin_finish.x-origin_start.x)*speed
velocity.y=(origin_finish.y-origin_start.y)*speed
velocity.z=(origin_finish.z-origin_start.z)*speed

Where speed is any number you feel like (higher number == faster speed)

Quote:
Originally Posted by XxAvalanchexX
As the angles vector represents a certain rotation on a certain axis (X, Y, or Z), the velocity vector represents speeds in a certain direction (X, Y, Z).
??? Vectors that have been normalized are angles. Angles are not vectors (by definition, vectors are angles with a speed).
BlueRaja is offline
Send a message via AIM to BlueRaja Send a message via MSN to BlueRaja
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 01-16-2005 , 08:21  
Reply With Quote #10

Ummm... Normalized vectors are vector with length = 1 ... So, to normalize a vector, you have to divide each compenent by the length of the vector.

If you want something to move from origin A to origin B, and want it to be done after y seconds, do what BlueRaja proposed. If you want it to go at a constant speed, no matter how far A and B are from each other, first normalize the vector ( the vector I refer to is the result of the subtraction ), and then multiply it by the speed.

You can find some vector functions in my "XS Library"; amxmodx/scripting/include/xs.inc
__________________
hello, i am pm
PM 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 19:17.


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