这是DSHGFHDS的建筑材料插件,我加上了实体面向搬者功能。
实体们只有朝着一個方向オ有正确的大小
![](http://imgsrc.baidu.com/forum/w%3D580/sign=0bf08a287ccb0a4685228b315b62f63e/80ae962f070828381833b4c6bf99a9014d08f173.jpg)
可是當我把它們围成一圏后,我就发现实体面朝的角度並没变,
角度变的只是水泥模型。
![](http://imgsrc.baidu.com/forum/w%3D580/sign=dfc926290d46f21fc9345e5bc6256b31/39fe0f0828381f30e127e57bae014c086f06f073.jpg)
public CheckPickedUp(iEntity)
{
new iPlayer = pev(iEntity, pev_iuser4)
if(!iPlayer)
return
if(!is_user_alive(iPlayer))
{
SetFree(iEntity)
return
}
new Sequence = pev(iEntity, pev_iuser2)
new Float:Length = MaterialMax[Sequence][0]-MaterialMin[Sequence][0]
new Float:Width = MaterialMax[Sequence][1]-MaterialMin[Sequence][1]
new Float:Distance = 30.0+floatsqroot(floatpower(Length, 2.0)+floatpower(Width, 2.0))/2.0
new Float:start[3], Float:view_ofs[3], Float:end[3]
pev(iPlayer, pev_origin, start)
pev(iPlayer, pev_view_ofs, view_ofs)
xs_vec_add(start, view_ofs, start)
pev(iEntity, pev_origin, end)
if(get_distance_f(start, end) > Distance+50.0)
{
SetFree(iEntity)
return
}
pev(iPlayer, pev_v_angle, end)
engfunc(EngFunc_MakeVectors, end)
global_get(glb_v_forward, end)
xs_vec_mul_scalar(end, Distance, end)
xs_vec_add(start, end, end)
new Float:velocity[3]
pev(iEntity, pev_origin, start)
if(get_distance_f(start, end) <= 5.0)
{
set_pev(iEntity, pev_velocity, { 0.0, 0.0, 0.0 })
return
}
get_speed_vector(start, end, 1000.0, velocity)
set_pev(iEntity, pev_velocity, velocity)
//我加的:
static Float:NewAngles[3], Float:OldAngles[3]
pev(iPlayer, pev_angles, NewAngles)
pev(iEntity, pev_angles, OldAngles)
NewAngles[2] = OldAngles[2]
NewAngles[0] -= NewAngles[0] * 2
set_pev(iEntity, pev_angles, NewAngles)
set_pev(iEntity, pev_v_angle, NewAngles)
}
实体们只有朝着一個方向オ有正确的大小
![](http://imgsrc.baidu.com/forum/w%3D580/sign=0bf08a287ccb0a4685228b315b62f63e/80ae962f070828381833b4c6bf99a9014d08f173.jpg)
可是當我把它們围成一圏后,我就发现实体面朝的角度並没变,
角度变的只是水泥模型。
![](http://imgsrc.baidu.com/forum/w%3D580/sign=dfc926290d46f21fc9345e5bc6256b31/39fe0f0828381f30e127e57bae014c086f06f073.jpg)
public CheckPickedUp(iEntity)
{
new iPlayer = pev(iEntity, pev_iuser4)
if(!iPlayer)
return
if(!is_user_alive(iPlayer))
{
SetFree(iEntity)
return
}
new Sequence = pev(iEntity, pev_iuser2)
new Float:Length = MaterialMax[Sequence][0]-MaterialMin[Sequence][0]
new Float:Width = MaterialMax[Sequence][1]-MaterialMin[Sequence][1]
new Float:Distance = 30.0+floatsqroot(floatpower(Length, 2.0)+floatpower(Width, 2.0))/2.0
new Float:start[3], Float:view_ofs[3], Float:end[3]
pev(iPlayer, pev_origin, start)
pev(iPlayer, pev_view_ofs, view_ofs)
xs_vec_add(start, view_ofs, start)
pev(iEntity, pev_origin, end)
if(get_distance_f(start, end) > Distance+50.0)
{
SetFree(iEntity)
return
}
pev(iPlayer, pev_v_angle, end)
engfunc(EngFunc_MakeVectors, end)
global_get(glb_v_forward, end)
xs_vec_mul_scalar(end, Distance, end)
xs_vec_add(start, end, end)
new Float:velocity[3]
pev(iEntity, pev_origin, start)
if(get_distance_f(start, end) <= 5.0)
{
set_pev(iEntity, pev_velocity, { 0.0, 0.0, 0.0 })
return
}
get_speed_vector(start, end, 1000.0, velocity)
set_pev(iEntity, pev_velocity, velocity)
//我加的:
static Float:NewAngles[3], Float:OldAngles[3]
pev(iPlayer, pev_angles, NewAngles)
pev(iEntity, pev_angles, OldAngles)
NewAngles[2] = OldAngles[2]
NewAngles[0] -= NewAngles[0] * 2
set_pev(iEntity, pev_angles, NewAngles)
set_pev(iEntity, pev_v_angle, NewAngles)
}