Coder Social home page Coder Social logo

Comments (4)

ClobberXD avatar ClobberXD commented on June 15, 2024

gunslinger/api.lua

Lines 61 to 67 in d20130a

-- pointer.intersection_normal is a zero vector
-- if ray originates from inside pointed_thing
if avoid_self and pthing and
vector.equals(pthing.intersection_normal, vector.new(0, 0, 0)) then
pthing = ray:next()
end
return pthing

The code already avoids the first pointed thing if the ray originates from within the pointed thing. Might it be possible that the ray encounters the same object again after skipping? That's highly unlikely...

Are you using the latest version (v0.24-pre) of Gunslinger?

from gunslinger.

9joshua avatar 9joshua commented on June 15, 2024

I cloned from the master branch 3 days ago. My version contains the code you pasted above.
It only happens when walking forward so maybe due to lag from the time the check is done to when it continues to trace?

from gunslinger.

ClobberXD avatar ClobberXD commented on June 15, 2024

From the API docs:

The map is loaded as the ray advances. If the map is modified after the
Raycast is created, the changes may or may not have an effect on the object.

This means that unless the Raycast object is re-created, it shouldn't detect the same player again and again. But there is a possibility of the ray originating from outside of the shooter's collision box due to lag (is this what you were saying?), which means the code linked in the previous post will not detect the player properly. Ideally, it's better to explicitly check for the player; I wanted to avoid string comparisons as they're computationally expensive. I'll see if there's a better way to check if an object corresponds to the shooter themselves.

from gunslinger.

9joshua avatar 9joshua commented on June 15, 2024

Yes, I think it could be due to lag from the time the ray is initiated to when the player moves forward and the ray progresses.

from gunslinger.

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.