• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] Actor weapon
#9
Here are simple code for that, only you need get offset and rotation for object



Create actor on center of map with angle = 0.0 and position 0.0,0.0,actor_z then create object on her hand or something.



Simple calculating after this process:

Code:
offset_x = object_x

offset_y = object_y

offset_z = object_z - actor_z

rx = object_rx

ry = object_ry

rz = object_rz



Code:
/*

#include <3DTryg> //https://www.burgershot.gg/showthread.php?tid=1898&highlight=3DTryg

*/



CreateDynamicActorWeapon(actorid,objectid,Float:offset_x,Float:offset_y,Float:offset_z,Float:rx,Float:ry,Float:rz){

new Float:x,Float:y,Float:z,

Float:tx,Float:ty,Float:tz,

Float:angle;



GetDynamicActorPos(actorid,x,y,z);

GetDynamicActorFacingAngle(actorid,angle);



ShiftOffsetToPosition(x,y,z,0.0,0.0,angle,offset_x,offset_y,offset_z,tx,ty,tz);

CreateDynamicObject(objectid,tx,ty,tz,rx,ry,Tryg3D::CompressRotation(rz橸));

}



CreateActorWeapon(actorid,objectid,Float:offset_x,Float:offset_y,Float:offset_z,Float:rx,Float:ry,Float:rz){

new Float:x,Float:y,Float:z,

Float:tx,Float:ty,Float:tz,

Float:angle;



GetActorPos(actorid,x,y,z);

GetActorFacingAngle(actorid,angle);



ShiftOffsetToPosition(x,y,z,0.0,0.0,angle,offset_x,offset_y,offset_z,tx,ty,tz);

CreateDynamicObject(objectid,tx,ty,tz,rx,ry,Tryg3D::CompressRotation(rz橸));

}
  Reply


Messages In This Thread
Actor weapon - by annety - 2021-03-07, 02:30 PM
RE: Actor weapon - by Virsenas - 2021-03-07, 02:34 PM
RE: Actor weapon - by Y_Less - 2021-03-07, 04:28 PM
RE: Actor weapon - by annety - 2021-03-08, 01:16 AM
RE: Actor weapon - by Y_Less - 2021-03-10, 02:06 AM
RE: Actor weapon - by Radical - 2021-03-10, 10:38 AM
RE: Actor weapon - by annety - 2021-03-21, 06:47 PM
RE: Actor weapon - by annety - 2021-04-20, 06:22 AM
RE: Actor weapon - by AbyssMorgan - 2021-04-20, 02:53 PM
RE: Actor weapon - by annety - 2021-04-21, 07:19 AM
RE: Actor weapon - by annety - 2021-04-26, 08:30 AM
RE: Actor weapon - by AbyssMorgan - 2021-04-27, 03:05 PM

Forum Jump: