How can I fit the object position next to the player -
NeXoR - 17.04.2016
Hey guys, as far as I have been told in the forums, If I want to script a stoppable stretcher system then I should do it using SetObjectPos over OnPlayerUpdate, and so I tried
But the offsets are too weird, sometimes I fly on the stretcher beacuse im on it's front
How can I do the Rotation to be on the LEFT of the character no matter what his angle is
Current code:
PHP код:
if(MovingStretcher[playerid] == 1)
{
new Float:pos[3], Float:A;
GetPlayerFacingAngle(playerid, A);
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
SetObjectPos(StretcherObj[playerid], pos[0]-1.00, pos[1], pos[2]-0.50);
SetObjectRot(StretcherObj[playerid], 0.00, 0.00, A);
}
Re: How can I fit the object position next to the player -
Nero_3D - 18.04.2016
PHP код:
new Float:pos[3], Float:A;
GetPlayerFacingAngle(playerid, A);
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
SetObjectPos(StretcherObj[playerid], pos[0] - floatcos(A, degrees), pos[1] - floatsin(A, degrees), pos[2]-0.50);
SetObjectRot(StretcherObj[playerid], 0.00, 0.00, A);
That would place the stretcher 1 meter left from the player
Re: How can I fit the object position next to the player -
NeXoR - 18.04.2016
Quote:
Originally Posted by Nero_3D
PHP код:
new Float:pos[3], Float:A;
GetPlayerFacingAngle(playerid, A);
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
SetObjectPos(StretcherObj[playerid], pos[0] - floatcos(A, degrees), pos[1] - floatsin(A, degrees), pos[2]-0.50);
SetObjectRot(StretcherObj[playerid], 0.00, 0.00, A);
That would place the stretcher 1 meter left from the player
|
Works nice, two things
1. How can I reduce the lag ? I mean make it move faster and not to shake every step I do
2. Can you explain what you have changed ? I'm still supposed to learn something at all
Re: How can I fit the object position next to the player -
NeXoR - 19.04.2016
Anyone ?
Re: How can I fit the object position next to the player -
AdrianG - 20.04.2016
Use the script in Onplayerupdate or I don't understand what do you mean
Re: How can I fit the object position next to the player -
NeXoR - 20.04.2016
Quote:
Originally Posted by AdrianG
Use the script in Onplayerupdate or I don't understand what do you mean
|
It's on onplayerupdate already
But it still moves with a delay
Re: How can I fit the object position next to the player -
Nero_3D - 23.04.2016
If you want to attach it use
https://sampwiki.blast.hk/wiki/AttachObjectToPlayer
Use -1 for x offset