I’ve been messing around with vectors and angle a lot and have hit a mental roadblock.
I’m trying to make a SENT that hovers a little bit above the ground (and moves like a vehicle, but first things first). The problem is that it will over at the wrong angles. I need it’s pitch and roll to match the slant of the surface it’s hovering over.
Here’s my trace code:
[lua]
// Trace down from the outter bounding radius
local startTraceDown = ( self.Entity:GetPos() + self:OBBCenter() ) + ( self.Entity:GetVelocity():Angle():Forward() * self:BoundingRadius() )
local endTraceDown = startTraceDown + Vector(0,0,-1000)
self.traceGroundNorm = util.QuickTrace( startTraceDown, endTraceDown, { self, ply } ) – Trace the ground
[/lua]
I tried using the Angle function and RotateAroundAxis, but to no avail. How would I get the pitch/roll angles to match the ground below a SENT?