PDA

View Full Version : about velocity


tjdgns9246
02-01-2012, 00:02
i want to know about velocity.

i've known that velocity is just about speed.

but i saw something confusing.


for example


stock GetEntityVelocity(entity, Float:fVelocity[3])
{
GetEntPropVector(entity, Prop_Data, "m_vecVelocity", fVelocity);
}



if i get that velocity, now i have "m_vecVelocity" of 3 dimensions, right?

and someone used this



g_iVelocity = FindSendPropOffs("CBasePlayer", "m_vecVelocity[0]");

//skipped...

new Float:vecVelocity[3];
GetEntDataVector(client, g_iVelocity, vecVelocity);

vecVelocity[2] += speed;

TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, vecVelocity);


as you know, code above is in jetpack.sp

and the problem is, why did he use "m_vecVelocity[0]"?

i want to know about difference between [0], [1], [2].

i think it's not like x,y,z or angles.

thanks

Zephyrus
02-01-2012, 01:07
they are x y and z

tjdgns9246
02-01-2012, 05:37
they are x y and z

just x y and z?

i don't know what is exactly x y z.

could you explain it, please?

Zephyrus
02-01-2012, 07:05
Velocity is a vector starting from the position of the entity

claudiuhks
02-01-2012, 08:27
The game map is written into a 3d room.
Each wall and each floor has three dimensions, X, Y and Z.

If you increase the player's velocity like:


decl Float: fVelocity[ 3 ];
GetEntPropVector( iPlayer, Prop_Data, "m_vecVelocity", fVelocity );

fVelocity[ 2 ] = 1750.0;

/*
You can also use:

fVelocity[ 2 ] += 1.0;
fVelocity[ 2 ] -= 1.0;
fVelocity[ 2 ] /= 1.0;
fVelocity[ 2 ] *= 1.0;
*/

TeleportEntity( iPlayer, NULL_VECTOR, NULL_VECTOR, fVelocity /* We need only modify velocity */ );


The player will be thrown to ceil with a big power, the power measured in '???' that is 1750.

So, X = abscissa, Y = ordinate and Z = height.
X and Y are horizontal axes.


fVelocity[ 0 ]; // is X
fVelocity[ 1 ]; // is Y
fVelocity[ 2 ]; // is Z


See also: Wikipedia (http://en.wikipedia.org/wiki/Cartesian_coordinate_system)

tjdgns9246
02-01-2012, 09:14
The game map is written into a 3d room.
Each wall and each floor has three dimensions, X, Y and Z.

If you increase the player's velocity like:


decl Float: fVelocity[ 3 ];
GetEntPropVector( iPlayer, Prop_Data, "m_vecVelocity", fVelocity );

fVelocity[ 2 ] = 1750.0;

/*
You can also use:

fVelocity[ 2 ] += 1.0;
fVelocity[ 2 ] -= 1.0;
fVelocity[ 2 ] /= 1.0;
fVelocity[ 2 ] *= 1.0;
*/

TeleportEntity( iPlayer, NULL_VECTOR, NULL_VECTOR, fVelocity /* We need only modify velocity */ );


The player will be thrown to ceil with a big power, the power measured in '???' that is 1750.

So, X = abscissa, Y = ordinate and Z = height.
X and Y are horizontal axes.


fVelocity[ 0 ]; // is X
fVelocity[ 1 ]; // is Y
fVelocity[ 2 ]; // is Z


See also: Wikipedia (http://en.wikipedia.org/wiki/Cartesian_coordinate_system)

i already knew about basic concepts like 3 dimensions.

but now, i can fully understand about velocity.

thank you for your information, claudiuhks.

tjdgns9246
02-01-2012, 09:17
Velocity is a vector starting from the position of the entity

thank you too, zephyrus.

i think you like short and clear :)