JBMod / jbmod

Official bug tracker and request tracker for JBMod
https://www.jbmod.com/
13 stars 1 forks source link

Improve physgun rotation #36

Open relt-1 opened 1 year ago

relt-1 commented 1 year ago

Is your feature request related to a problem? Please describe. The system is done very badly in general. It simply adds the delta of mouse movements to the world angles of the prop. It should use the player matrix as the rotation axis and use the angles delta as the degree of rotation.

Describe the solution you'd like Here is pseudocode that would achieve the desired result:

//matrix structure: 
//[
//[forwardx,forwardy,forwardz]
//[rightx,righty,rightz]
//[upx,upy,upz]
//]
//propangles: desired prop angles
//lastviewangles: last angles before holding E
//angles: wanted angles by the mouse movement
float playermatrix[3][3];
GetAngleMatrix(lastviewangles,playermatrix); //Get matrix of the angles
float propmatrix[3][3];
GetAngleMatrix(propangles,propmatrix);
float delta[3][3];
CreateAxisRotationMatrix(playermatrix[2],lastviewangles[1]-angles[1],delta); //axis: up  degrees: right/left
float firstrotation[3][3];
ConcatenateAngleMatrixes(propmatrix,delta,firstrotation); //ConcatenateAngleMatrixes(IN1,IN2,OUT)
CreateAxisRotationMatrix(playermatrix[1],lastviewangles[0]-angles[0],delta);  //axis: right  degrees: up/down
ConcatenateAngleMatrixes(firstrotation,delta,propmatrix);
GetMatrixAngle(propmatrix,propangles); //Get angles of the matrix
Grizler556 commented 1 year ago

yeah the mfing physgun rotation sucks, i cant even rotate ragdolls which is retarded :skull:

hopefully the new update that is going to release in 2 days is going to fix it

Nafrayu commented 1 year ago

It looks fine to me? This is me moving my mouse up and down vs. left and right:

https://streamable.com/8zhp8g

Did you try it without sourcemod loaded?

Grizler556 commented 1 year ago

It works fine on props, but not on ragdolls