[求助]有关c_move的问题
3DGS手册中有关c_move的参数是这样写的Parameters:
entity Entity to be moved.
reldist Move distance vector in entity coordinates
absdist Move distance vector in world coordinates
mode Collision mode, see below.
1.reldist和absdist这两个参数有什么不同呢?
2.这句代码中result返回的是什么值呢?5*time,0,0分别代表什么呢?
result = c_move(me,vector(5*time,0,0),nullvector,IGNORE_YOU|GLIDE); 1.reldist是相對移動,相對於模型自身的軸心。
absdist是絕對移動,相對於關卡軸心。
2.result返回是次移動了的距離。
vector(5*time_step,0,0)中的5*time_step是向量的x值,其餘是y和z值。
PS: 較新的版本已經將time改為time_step,因為time與c++的關鍵字眼重疊。 引用第1楼ultranet于2007-08-07 14:21发表的:
1.reldist是相對移動,相對於模型自身的軸心。
absdist是絕對移動,相對於關卡軸心。
2.result返回是次移動了的距離。
vector(5*time_step,0,0)中的5*time_step是向量的x值,其餘是y和z值。
.......
谢了,那向量的x值实际上是移动了多少呢?还有就是参数var mode中的GLIDE(教程上解释为Glides along walls and entities on impact.)是不是沿着某一实体的表面滑行呀? 引用第2楼lrc123于2007-08-07 17:08发表的:
谢了,那向量的x值实际上是移动了多少呢?还有就是参数var mode中的GLIDE(教程上解释为Glides along walls and entities on impact.)是不是沿着某一实体的表面滑行呀?
5 quants per frame。
對,GLIDE是與碰撞的物體表面磨擦前進。 引用第3楼ultranet于2007-08-07 19:37发表的:
5 quants per frame。
對,GLIDE是與碰撞的物體表面磨擦前進。
那如果碰到其他实体的话会触发事件吗?c_move好象没看见哪里有设置碰撞后触发事件的参数耶
6.地形算实体吗? 事件是這樣設置的,拜託看教程和查手冊............
Example (lite-C):
// The following example shows how to use events for an object that flies ahead until it collides with a block or entity.
// The event function then plays a collision sound and lets the object ricochet from the surface.
function bounce_event()
{
switch (event_type)
{
case EVENT_BLOCK:
ent_playsound(my,whamm,50);
vec_to_angle(my.pan,bounce); // change direction
return;
case EVENT_ENTITY:
ent_playsound(my,boingg,50);// play a different sound
vec_to_angle(my.pan,bounce); // change direction
return;
}
}
action bounceball()
{
my.emask |= ENABLE_BLOCK | ENABLE_ENTITY; // make entity sensitive for block and entity collision
my.event = bounce_event;
while(1)
{
c_move(me,vector(5*time_step,0,0),nullvector,0); // move ahead until obstacle is hit
wait(1);
}
} 引用第5楼ultranet于2007-08-07 22:33发表的:
事件是這樣設置的,拜託看教程和查手冊............
Example (lite-C):
// The following example shows how to use events for an object that flies ahead until it collides with a block or entity.
// The event function then plays a collision sound and lets the object ricochet from the surface.
.......
5*time_step这个是可不可以直接换成数字呢?
PS:你英文这么好,有中文版还在用E文的,当然是问你最好喇 本来time_step就是整数变量。。。可以,不过那个是固定的 引用第7楼萌是什么?于2007-08-08 12:34发表的:
本来time_step就是整数变量。。。可以,不过那个是固定的
5不就是整数变量吗?干嘛还要乘个time_step呢?不过,我发现去掉time_step后移动速度貌似快了很多 引用第6楼lrc123于2007-08-08 11:25发表的:
5*time_step这个是可不可以直接换成数字呢?
PS:你英文这么好,有中文版还在用E文的,当然是问你最好喇
TIME_STEP=16/FPS
TIME_STEP是根據frames per second(幀速)而變的,
當fps是32,time_step=0.5; 4*time_step=2; 32*2=64 quants/s;
當fps是16,time_step=1; 4*time_step=4; 4*16=64 quant/s;
所以無論fps是多少都好,time_step可以幫助維持一個均值,這樣低配置抑或高配置的電腦,畫面上看到的結果(e.g.移動速度)是差不多的。
页:
[1]