Comments (5)
from gothicfreeaim.
The above approaches are incorrect. Refer to this link.
from gothicfreeaim.
The code above is completely wrong.
from gothicfreeaim.
The distance cannot be adjusted, as it is needed in other functions the way it is now. Instead implement a new function argument in aimRay()
to retrieve a "true distance" separately.
from gothicfreeaim.
Before:
// Manipulate aiming position (scatter/accuracy): Rotate position by y and z axes
var zMAT4 camPos; camPos = _^(MEM_ReadInt(MEM_ReadInt(MEMINT_oGame_Pointer_Address)+20)+60); //0=right, 2=out, 3=pos
pos[0] = subf(pos[0], camPos.v0[3]); // For modifying the angle, move the vector to origin (afterwards back)
pos[1] = subf(pos[1], camPos.v1[3]);
pos[2] = subf(pos[2], camPos.v2[3]);
var int accuracy; accuracy = 0; // Outsource into a function e.g. getAccurracy();
if (accuracy > 100) { accuracy = 100; } else if (accuracy < 1) { accuracy = 1; };
var int angleMax; angleMax = roundf(mulf(mulf(fracf(1, accuracy), castToIntf(FREEAIM_SCATTER_DEG)), mkf(1000)));
var int angleY; angleY = fracf(r_MinMax(-angleMax, angleMax), 1000);
SinCosApprox(Print_ToRadian(angleY));
var int rotX; rotX = addf(mulf(pos[0], cosApprox), mulf(pos[2], sinApprox));
pos[2] = subf(mulf(pos[2], cosApprox), mulf(pos[0], sinApprox));
angleMax -= roundf(mulf(absf(angleY), mkf(1000))); // Diamond scatter pattern
var int angleZ; angleZ = fracf(r_MinMax(-angleMax, angleMax), 1000);
SinCosApprox(Print_ToRadian(angleZ));
pos[0] = subf(mulf(rotX, cosApprox), mulf(pos[1], sinApprox));
pos[1] = addf(mulf(rotX, sinApprox), mulf(pos[1], cosApprox));
pos[0] = addf(pos[0], camPos.v0[3]); // Move back, past camera position
pos[1] = addf(pos[1], camPos.v1[3]);
pos[2] = addf(pos[2], camPos.v2[3]);
Corrected:
- Correct the distance in aimRay to reflect the distance from intersection to camera.
- Rework the scattering like so:
/* Retrieve only distance from aimRay(), not position */
// Manipulate aiming position (scatter/accuracy): Rotate position around y and x axes (left/right, up/down)
var int pos[3]; pos[0] = FLOATNULL; pos[1] = FLOATNULL; pos[2] = distance;
var int accuracy; accuracy = 0; // Outsource into a function e.g. getAccurracy();
if (accuracy > 100) { accuracy = 100; } else if (accuracy < 1) { accuracy = 1; };
var int angleMax; angleMax = roundf(mulf(mulf(fracf(1, accuracy), castToIntf(FREEAIM_SCATTER_DEG)), mkf(1000)));
var int angleY; angleY = fracf(r_MinMax(-angleMax, angleMax), 1000);
SinCosApprox(Print_ToRadian(angleY)); // Rotate around y-axis (left-right scatter)
pos[0] = mulf(pos[2], sinApprox); // x*cosθ + z*sinθ = x'
pos[2] = mulf(pos[2], cosApprox); // −x*sinθ + z*cosθ = z'
angleMax = roundf(sqrtf(subf(sqrf(mkf(angleMax)), sqrf(mulf(angleY, mkf(1000)))))); // sqrt(angleMax^2-angleY^2), pattern, see #48
var int angleX; angleX = fracf(r_MinMax(-angleMax, angleMax), 1000);
SinCosApprox(Print_ToRadian(angleX)); // Rotate around x-axis (up-down scatter)
pos[1] = mulf(negf(pos[2]), sinApprox); // y*cosθ − z*sinθ = y'
pos[2] = mulf(pos[2], cosApprox); // y*sinθ + z*cosθ = z'
var zMAT4 camPos; camPos = _^(MEM_ReadInt(MEM_ReadInt(MEMINT_oGame_Pointer_Address)+20)+60); //0=right, 2=out, 3=pos
pos[0] = addf(camPos.v0[3], pos[0]); // Add vector to camera position
pos[1] = addf(camPos.v1[3], pos[1]);
pos[2] = addf(camPos.v2[3], pos[2]);
from gothicfreeaim.
Related Issues (20)
- Update project architecture diagram
- Finish wiki
- Decrease fine scattering angle HOT 1
- Decrease secondary modulation of accuracy HOT 1
- Crash on loading related to oCNpc::SetBodyState HOT 2
- Projectiles are not destroyed when reuse-feature is disabled in Gothic 1
- Simplify categorizing spells for drawing reticle in config
- Remove debugging visualizations (Draw3D) from default initialization
- Low FPS prevent aiming with crossbow T2 stance
- Crash when initializing GFA_SPELLS without GFA_STRAFING
- Focus mode is wrong when loading game in fight mode HOT 1
- Display reticle in virtual coordinates HOT 1
- Move "no focus no aim" to INI
- [Returning 2.0] Game crashes after intros while using Ninja GFA patch HOT 2
- Provide projectile pointer to config function HOT 1
- Add safety checks for common fixes HOT 1
- ITEM_FOCUS HOT 1
- New idea - free hiting
- [Gothic Multiplayer] AimRay intersection with player's camera bbox HOT 4
- [Singleplayer] FPS Drops / [Multiplayer] Not able to connect HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gothicfreeaim.