|
|

楼主 |
发表于 2006-5-28 13:58:00
|
显示全部楼层
Re: Re: 求助:如何让mesh缓慢移动?
seer: Re: 求助:如何让mesh缓慢移动?
在解决你的问题前给你提点建议:
1。全局变量前面加g_
2。工程要把源代码包含全了,你的这个工程是没法生...
谢谢你的建议~~以后一定注意。按你的方法,地球已经慢慢上升了~~~高兴死了。
可是我把它做了如下修改后,地球就只下降,没有上升的动作了,为什么呢?
float t_Heigth=0.0f;
int t_top = 0;
if (g_jumpstart!=0)
{
unsigned int T=timeGetTime()-g_jumpstart;
if (T<2000)
{
t_Heigth=(float)T/500;
}else if((T>=2000)&&(T<4000))
{
t_Heigth=4.0f;
}else if((T>=4000)&(T<40000))
{
t_Heigth=(float)(40000-T)/1000;
}else if(T>=40000)
{
g_jumpstart=0;
}
D3DXMATRIXA16 matWorld;
D3DXMatrixTranslation&matWorld,0.0f,t_Heigth,0.0f);
Device->SetTransform(D3DTS_WORLD,&matWorld);
top = 1;
}
if (top !=0)
{
D3DXMATRIXA16 matWorld;
D3DXMatrixTranslation(&matWorld,0.0f,-t_Heigth,0.0f);
Device->SetTransform(D3DTS_WORLD,&matWorld);
top = 0;
}
为什么呢?就是想让地球再落下来的。 |
|