Discuz! Board

标题: [代码|Code]获取附件|Get Attachment [打印本页]

作者: Jerry小坏    时间: 2017-7-13 16:43
标题: [代码|Code]获取附件|Get Attachment
1. 获取附件坐标|Get Attachment Origin
说明|Description:
[CN]由于客户端与服务端的延迟,这个方法不适合玩家实体
[EN]This way is not for "Player Entity" because of the lag between ClientSide and ServerSide
  1. new Float: __float_Org[ 3 ], Float: __float_Ang[ 3 ];
  2. engfunc( EngFunc_GetAttachment, __int_Client, 0, __float_Org, __float_Ang );
复制代码


2.实体附件索引|Entity Attachment Index
说明|Description:
[CN]此方法对玩家实体和模型实体通用
[EN]This way is for both "Player Entity" and "Model Entity"
  1. /*
  2. Attachment 0( Client|0x1000 ) = Right Hand( Usually )
  3. Attachment 1( Client|0x2000 ) = Left Hand( Usually )
  4. Attachment 2( Client|0x3000 ) = Extra
  5. Attachment 3( Client|0x4000 ) = Extra
  6. */
  7. message_begin( MSG_ALL, SVC_TEMPENTITY );
  8. write_byte(TE_BEAMENTPOINT);
  9. write_short( __int_Client|0x1000 );// Right Hand ( Usually )
  10. engfunc( EngFunc_WriteCoord, __float_Org[ 0 ] + random_float( -10.000_000, 10.000_000 ) );
  11. engfunc( EngFunc_WriteCoord, __float_Org[ 1 ] + random_float( -10.000_000, 10.000_000 ) );
  12. engfunc( EngFunc_WriteCoord, __float_Org[ 2 ] + random_float( -10.000_000, 10.000_000 ) );
  13. write_short( 101 );
  14. write_byte( 10 );
  15. write_byte( 10 );
  16. write_byte( 5 );
  17. write_byte( 2 );
  18. write_byte( 3 );
  19. write_byte( 255 );
  20. write_byte( 255 );
  21. write_byte( 255 );
  22. write_byte( 255 );
  23. write_byte( 50 );
  24. message_end();

  25. message_begin( MSG_ALL, SVC_TEMPENTITY );
  26. write_byte(TE_BEAMENTPOINT);
  27. write_short( __int_Client|0x2000 );// Left Hand ( Usually )
  28. engfunc( EngFunc_WriteCoord, __float_Org[ 0 ] + random_float( -10.000_000, 10.000_000 ) );
  29. engfunc( EngFunc_WriteCoord, __float_Org[ 1 ] + random_float( -10.000_000, 10.000_000 ) );
  30. engfunc( EngFunc_WriteCoord, __float_Org[ 2 ] + random_float( -10.000_000, 10.000_000 ) );
  31. write_short( 101 );
  32. write_byte( 10 );
  33. write_byte( 10 );
  34. write_byte( 5 );
  35. write_byte( 2 );
  36. write_byte( 3 );
  37. write_byte( 255 );
  38. write_byte( 255 );
  39. write_byte( 255 );
  40. write_byte( 255 );
  41. write_byte( 50 );
  42. message_end();
复制代码








Q: 怎么为模型添加附件?|How to add attachment for a model?

A: 在QC文件里面使用$attachment语句|Use the function "$attachment" in the QC file
  1. //$attachment Index "Joint Name" X Y Z
  2. $attachment 0 "Bip01 R Hand" 2.000000 2.000000 0.300000
  3. $attachment 1 "Bip01 R Hand" 2.000000 2.000000 0.000000
  4. $attachment 2 "Bip01 L Hand" 0.000000 0.000000 0.000000
  5. $attachment 3 "Bip01 R Leg" 0.000000 0.000000 0.000000
复制代码








欢迎光临 Discuz! Board (https://esfbbs.foxnyx.top/) Powered by Discuz! X3.2