Code Monkey home page Code Monkey logo

Comments (6)

szapp avatar szapp commented on September 25, 2024

Fix #25 correct ray start vector

from gothicfreeaim.

szapp avatar szapp commented on September 25, 2024

Now trying this: Point-Line Distance, where x0 is the point, and x1 and x2 make up the line.

  • x0 = camera
  • x1 = player model
  • x2 = help point (left/right of player model along the right-vector of the camera)
|(x0 - x1) X (x0 - x2)|      <- *
-----------------------
       |x2 - x1|

*) u X v = ((uy*vz - uz*vy), (uz*vx - ux*vz), (ux*vy - uy*vx))

from gothicfreeaim.

szapp avatar szapp commented on September 25, 2024

Another failed attempt (just copying it here because it made it into no commit):

d[0] = subf(MEM_ReadInt(_@(her)+72), MEM_ReadInt(MEM_Camera.connectedVob+72));
d[1] = subf(MEM_ReadInt(_@(her)+88), MEM_ReadInt(MEM_Camera.connectedVob+88));
d[2] = subf(MEM_ReadInt(_@(her)+104), MEM_ReadInt(MEM_Camera.connectedVob+104));
const int zMAT4__Rotate = 5542544; //0x549290
CALL_PtrParam(_@(d));
CALL_RetValIsStruct(12);
CALL__thiscall(MEM_Camera.connectedVob+60, zMAT4__Rotate);
var int dPtr; dPtr = CALL_RetValAsInt();
MEM_CopyWords(dPtr, _@(d), 3);
MEM_Free(dPtr);

d[0] = FLOATNULL;
var int dist; dist = sqrtf(addf(addf(sqrf(d[0]), sqrf(d[1])), sqrf(d[2])));

d[0] = addf(MEM_ReadInt(MEM_Camera.connectedVob+72),  mulf(MEM_ReadInt(MEM_Camera.connectedVob+68),  dist));
d[1] = addf(MEM_ReadInt(MEM_Camera.connectedVob+88),  mulf(MEM_ReadInt(MEM_Camera.connectedVob+84),  dist));
d[2] = addf(MEM_ReadInt(MEM_Camera.connectedVob+104), mulf(MEM_ReadInt(MEM_Camera.connectedVob+100), dist));

from gothicfreeaim.

szapp avatar szapp commented on September 25, 2024

This does not work, because d[x] is the world coordinate. The local coordinate of cam must be considered instead.

from gothicfreeaim.

szapp avatar szapp commented on September 25, 2024

Simpler approach:

d = model.pos - cam.pos

d[x] = 0

d = model.pos + d

from gothicfreeaim.

szapp avatar szapp commented on September 25, 2024

cam.pos[3] + (cam.out[3] * x) = model.pos[3] - (cam.right[3] * y)

Solve for x.

cam.pos[3] + (cam.out[3] * x) is the new start vector.

from gothicfreeaim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.