Access Raw DeltaX and DeltaY for Mouse input.
13 posts
• Page 1 of 2 • 1, 2
Access Raw DeltaX and DeltaY for Mouse input.
Hi,
Is it possible to access the raw deltaX/Y ?
are mouse_status(0) and mouse_status(1) the raw deltaX/Y ?
thanks
Is it possible to access the raw deltaX/Y ?
are mouse_status(0) and mouse_status(1) the raw deltaX/Y ?
thanks
-
paname - Sergeant Major of the Army
- Posts: 204
- Joined: Wed Jan 07, 2015 3:02 pm
Re: Access Raw DeltaX and DeltaY for Mouse input.
paname wrote:are mouse_status(0) and mouse_status(1) the raw deltaX/Y ?
You are right. Instead of use the numeric references, use the defines included in the mouse.ghp, for example:
- Code: Select all
#include <mouse.gph>
int32 delta_x, delta_y;
uint32 m_timestamp;
main {
if(m_timestamp != mouse_status(MREPORT_TIMESTAMP)) {
m_timestamp = mouse_status(MREPORT_TIMESTAMP);
delta_x = mouse_status(MOUSE_X);
delta_y = mouse_status(MOUSE_Y);
} else {
delta_x = 0;
delta_y = 0;
}
}
ConsoleTuner Support Team
-
J2Kbr - General of the Army
- Posts: 20323
- Joined: Tue Mar 18, 2014 1:39 pm
Re: Access Raw DeltaX and DeltaY for Mouse input.
thanks for your reply.
on a side i m also testing scripts over the destiny mouse input translater and i find that this one improve it a bit but that's all subjective and need variable tweaking especially when adding Diagonal dampening
full script :
on a side i m also testing scripts over the destiny mouse input translater and i find that this one improve it a bit but that's all subjective and need variable tweaking especially when adding Diagonal dampening
- Code: Select all
// Apply Diagnonal Dampening DD in (0,1)
// C = 1 -abs(abs(sin(angle))-abs(cos(angle)))
// M = (1 - C * DD) * M
fix32 C = 1.00 - abs(abs(sin(angle))-abs(cos(angle)));
magnitude = (1.00 - C * DD) * magnitude;
full script :
- Code: Select all
#pragma METAINFO("", 1, 0, "paname")
#include <mouse.gph>
fix32 TE = 0.84;
fix32 Sensi = 2.0;
fix32 DD = 0.33;
fix32 dz = 0.0;
fix32 yxratio = 1.2;
fix32 rx,ry,OutX,OutY,magnitude2;
int32 delta_x, delta_y;
uint32 m_timestamp;
main {
rx = get_val(STICK_1_X);
ry = get_val(STICK_1_Y);
// Smooth raw DeltaX and DeltaY (weighted FILO queue)
// TBD
// Apply YXRatio (DeltaY = DeltaY * YXRatio)
ry = yxratio * ry;
// Convert from X/Y to Polar Magnitude/Angle
fix32 angle = atan2(ry,rx) ;
fix32 magnitude = sqrt(rx*rx + ry*ry);
// Apply Translation Exponent (TE) , M = M ^ TE TE in (0,1)
magnitude = pow(magnitude, TE);
// Apply Sensitivity (S) , M = M * S
magnitude = magnitude * Sensi ;
// Apply Diagnonal Dampening DD in (0,1)
// C = 1 -abs(abs(sin(angle))-abs(cos(angle)))
// M = (1 - C * DD) * M
fix32 C = 1.00 - abs(abs(sin(angle))-abs(cos(angle)));
magnitude = (1.00 - C * DD) * magnitude;
// Apply DeadZone Shape & Convert Polar to Cart
OutX = cos(angle) * (magnitude + dz ) ;
OutY = sin(angle) * (magnitude + dz ) ;
// Clamp OutX , OutY
OutX = clamp(OutX,-100.00,100.00);
OutY = clamp(OutY,-100.00,100.00);
set_val(STICK_1_X,OutX);
set_val(STICK_1_Y,OutY);
}
-
paname - Sergeant Major of the Army
- Posts: 204
- Joined: Wed Jan 07, 2015 3:02 pm
Re: Access Raw DeltaX and DeltaY for Mouse input.
Interesting, very similar to a script I made to use with my FragFX (a mouse like controller). Understood everything you did, but the "Diagonal Dampening". I mean, the math is clear, but how it can improve the mouse conversion. Do you have any reference about this I can read? this may be something to add to the regular mouse conversion algorithm. thanks.
ConsoleTuner Support Team
-
J2Kbr - General of the Army
- Posts: 20323
- Joined: Tue Mar 18, 2014 1:39 pm
Re: Access Raw DeltaX and DeltaY for Mouse input.
J2Kbr wrote: Understood everything you did, but the "Diagonal Dampening". I mean, the math is clear, but how it can improve the mouse conversion. Do you have any reference about this I can read? this may be something to add to the regular mouse conversion algorithm. thanks.
Controllers have a certain sensitivity to diagonal movements. The diagonal dampening factor adjusts the input movement values to reduce the console's sensitivity to diagonal movements.
that's a concept that was prevalent in early version of Xim and people were all proposing their "perfect value" for a given game before Obsiv automated the process of finding the right value with an automated tool (using opencv like tool) and called it "smart translator" and i also found the math formula for the diagonal dampening in this documents from a microsoft engineer :
https://patentimages.storage.googleapis ... D00003.png
DD can take value between 0.00 and 1.00,
a DD factor of 0 does not affect any diagonal movement, and a DD factor of 1 will make no diagonal movement possible
I think that finding the right DD factor for a game look mechanic is key to make movement super smooth.
( validated by doing small mouse circle test)
-
paname - Sergeant Major of the Army
- Posts: 204
- Joined: Wed Jan 07, 2015 3:02 pm
Re: Access Raw DeltaX and DeltaY for Mouse input.
Thank you very much for this info. I am convinced. After some testing it is very probable we will add the DD parameter to the Mouse Conversion interface in the Input Translator.
GitHub:
https://github.com/J2Kbr/GtunerIV/issues/147
GitHub:
https://github.com/J2Kbr/GtunerIV/issues/147
ConsoleTuner Support Team
-
J2Kbr - General of the Army
- Posts: 20323
- Joined: Tue Mar 18, 2014 1:39 pm
Re: Access Raw DeltaX and DeltaY for Mouse input.
Today I did some testing using the diagonal dampening factor and, omg, it made a significant difference, for the good. Tested only on BF1 so far. I will be checking with other games, but I am positive the results will be the same.
The DD Factor is already implemented on Gtuner's Input Translator, as well as on the device firmware. It will be available on the next software/firmware release.
The DD Factor is already implemented on Gtuner's Input Translator, as well as on the device firmware. It will be available on the next software/firmware release.
ConsoleTuner Support Team
-
J2Kbr - General of the Army
- Posts: 20323
- Joined: Tue Mar 18, 2014 1:39 pm
Re: Access Raw DeltaX and DeltaY for Mouse input.
Awesome work guys
Console tuner since my 1st controller.
Scripting, a game in the game.
Believe or dare, It's Titanic!
Scripting, a game in the game.
Believe or dare, It's Titanic!
-
Prototype - Major General
- Posts: 3252
- Joined: Sun Dec 16, 2012 1:43 pm
13 posts
• Page 1 of 2 • 1, 2
Return to GPC2 Script Programming
Who is online
Users browsing this forum: midg3t2 and 121 guests