[Include] Rotations.inc
#9

I am trying to create graffiti object in front of another graffiti object (graffiti tagged), but I don't know how to get position in front of object relative to object's rotation (rx, ry, rz). My actual code

Code:
new Float:lGraffitiX, Float:lGraffitiY, Float:lGraffitiZ, Float:lGraffitiRX, Float:lGraffitiRY, Float:lGraffitiRZ;
GetDynamicObjectPos(Graffiti[tagid][graffiti_object], lGraffitiX, lGraffitiY, lGraffitiZ);
GetDynamicObjectRot(Graffiti[tagid][graffiti_object], lGraffitiRX, lGraffitiRY, lGraffitiRZ);
Use(lGraffitiX, lGraffitiY, lGraffitiZ, lGraffitiRX, lGraffitiRY, lGraffitiRZ, lGraffitiX, lGraffitiY, lGraffitiZ);
Graffiti[tagid][graffiti_object_made] = CreateDynamicObject(18659, lGraffitiX, lGraffitiY, lGraffitiZ, lGraffitiRX, lGraffitiRY, lGraffitiRZ, .interiorid = 0);

Use(Float:oX, Float:oY, Float:oZ, Float:rX, Float:rY, Float:rZ, &Float:x, &Float:y, &Float:z)
{
	new 
    Float: matrix[4][4] 
; 
// Get rotation Matrix from Euler 
GetRotationMatrixFromEuler(matrix, rX, rY, rZ); 
// Rotate matrix around relative point of object 
// 0.0, 0.0, 1.0 = relative point = 1.0 above object center 
// 5.0, 0.0, 0.0 = euler rotation = 5.0 degress in rX direction 
RotMatrixEulerAroundRelPoint(matrix, 0.0, 0.0, 1.0, 5.0, 0.0, 0.0); 
// Getting relative point, 0.0, 0.0, 0.0, 1.0 = offsets x, y, z and translation 
// because we only need the translation we set, x, y, z offsets to 0.0 
MatrixRotate(matrix, 0.0, 0.0, 0.0, 1.0, oX, oY, oZ); 
x = oX;
y = oY;
z = oZ;
}
It works only with one angle, see image below. Grove tag should cover another tag. On the wall it works, but on the ground it does not. Any ideas?

https://i.imgur.com/3DXKHt7.jpg

//EDIT

Done it, I used wrong function. Working code

Code:
GetQuatFromEuler(rx, ry, rz, qw, qx, qy, qz);
QuatRotate(qw, qx, qy, qz, -0.05, 0.0, 0.0, x, y, z);
//use x, y, z
Reply


Messages In This Thread
Rotations.inc - by Nero_3D - 14.08.2016, 01:19
Re: Rotations.inc - by PT - 14.08.2016, 11:11
Re: Rotations.inc - by Sanady - 15.08.2016, 01:37
Re: Rotations.inc - by Nero_3D - 06.01.2017, 23:59
Re: Rotations.inc - by Crayder - 06.02.2017, 18:25
Re: Rotations.inc - by Nero_3D - 10.02.2017, 13:37
Re: Rotations.inc - by Crayder - 10.02.2017, 17:09
Re: Rotations.inc - by AbyssMorgan - 10.02.2017, 17:13
Re: Rotations.inc - by ball - 16.06.2017, 16:44
Re: Rotations.inc - by Nero_3D - 16.06.2017, 21:43
Re: Rotations.inc - by Nero_3D - 11.08.2017, 20:03
Re: Rotations.inc - by Admigo - 03.12.2017, 13:28
Re: Rotations.inc - by Nero_3D - 04.12.2017, 02:29
Re: Rotations.inc - by kennydalglish - 04.12.2017, 06:27
Re: Rotations.inc - by AbyssMorgan - 04.12.2017, 08:04
Re: Rotations.inc - by Nero_3D - 04.12.2017, 23:01
Re: Rotations.inc - by kennydalglish - 05.12.2017, 15:54
Re: Rotations.inc - by Nero_3D - 06.12.2017, 00:22
Re: Rotations.inc - by kennydalglish - 08.12.2017, 21:47
Re: Rotations.inc - by NaS - 08.03.2018, 15:02
Re: Rotations.inc - by Nero_3D - 16.03.2019, 21:26

Forum Jump:


Users browsing this thread: 5 Guest(s)