• Another simple yet impossible lua function.
    6 replies, posted
I have a point [I]inside[/I] the physics object of an entity. I want to have a trace go from that point, in a certain direction represented as a vector, and tell at what point it [I]left[/I] the entity. How would I do this??? Please help. Thanks!
[code]point = LerpVector( res.FractionLeftSolid, res.StartPos, res.HitPos )[/code] [url=http://wiki.garrysmod.com/page/Structures/TraceResult]TraceResult[/url] Assuming the wiki is correct, that's what you would do.
Ummm..... I tried this, and FractionLeftSolid doesn't work... It only returns 0... when a trace hits a solid it stops, so when a trace starts in a solid it doesn't go anywhere. Help? :(
Seems like a bit of a dumb way to do it but if LeftSolid doesn't work, couldn't you use ents.FindInBox? Like start at the center of the entity and then move along your vector until you can't find the entity.
It has to be a [I]very[/I] accurate vector, calculated along a specific axis relative to the entity. I'm not sure how I could use ents.FindInBox. :( ? If anyone's got any ideas on how to make FractionLeftSolid work, please respond! It is [I]exactly[/I] the right function for what I need to do.
[QUOTE=For Science;40286449]Ummm..... I tried this, and FractionLeftSolid doesn't work... It only returns 0... when a trace hits a solid it stops, so when a trace starts in a solid it doesn't go anywhere. Help? :([/QUOTE] Ignore the entity in the trace?
Did that work for you? Because when I tried that, the trace still returned 0, and it couldn't even tell that it started in a solid (StartSolid returned false). You mean putting the entity in the trace's filter, right?
Sorry, you need to Log In to post a reply to this thread.