• Trace endpos point down
    2 replies, posted
Hi, I am performing a TraceLine and would like to know if there is a way to get the trace to always point down even if the entity is rotated. For example: https://files.facepunch.com/forum/upload/111841/ba3aa805-74be-4a41-8440-3c965480cca3/image.png endpos = -self:GetUp() * 10 This traces a line that hits below the prop, but if i rotate it like so: https://files.facepunch.com/forum/upload/111841/c808658c-382f-47d1-a773-f05577e7b990/image.png It now traces the line upwards. I would like to know if there is a way to make the trace always point to the ground no matter the angle of the prop. Any help is appreciated, Thanks
GetUp() is a function that gets the "Up" vector of a given entity, but this is "local" or relative to the entity's rotation, which is why flipping the entity reverses this "up" (plus you're doing a - which turns GetUp into more of a GetDown, but I assume you understand that). If you always want a vector that always points to the ground, try something like Vector(0, -1, 0) assuming the Y axis is up and down, its been a while since I did Lua for gmod.
Thank you for the suggestion, what you said didn't completely work but I altered the values a bit, this is what worked: self:GetPos() + Vector(0, 0, -10)
Sorry, you need to Log In to post a reply to this thread.