• Detect If Surface Is 90 Degrees to Ground
    4 replies, posted
I feel as if I should know how to do this, but I was wondering how I could detect if a wall the player is looking at is 90 degrees to the ground. For example: [IMG]http://imgur.com/1dl6oMG.png[/IMG]
Trace towards the wall, Get the normal, Do Vector -> Angle.
I'm doing this. [lua] local normEndpoint = endpoint:GetNormal() print(normEndpoint:Angle()) [/lua] endpoint is the HitPos of the trace, I used GetNormal() instead of Normalize() because I need to use that vector later in the function. I traced to a wall that is perpendicular to the ground and this is the result I get. And its all over the place when I click on different spots of the wall. [lua] 0.881 34.584 0.000 2.552 34.659 0.000 [/lua]
Use HitNormal not HitPos
[QUOTE=OzymandiasJ;42957638]Use HitNormal not HitPos[/QUOTE] Thank you so much, it works perfectly!
Sorry, you need to Log In to post a reply to this thread.