2021-04-20, 02:53 PM
(This post was last modified: 2021-04-20, 02:54 PM by AbyssMorgan.)
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:
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橸));
}