• Zero-G Angle manipulation
    0 replies, posted
Hi there, I'm working on some code for a little spaceship thingo and I've hit a bit of a road block where it comes to changing the bearing. I'm looking to have it change it's bearing in accordance to the physics engine, not simply pointing it instantly like a GyroPod. I'd like to have it so that if the entity runs into something, it will bounce and feel kick-back instead of flipping-out as it tries to maintain its target angle and possibly crash the server. At the moment I have: [code] local targAng = Angle(0,90,0) --Or whatever local curAng = self.Entity:GetAngles() local diffP = curAng.p - targAng.p local diffY = curAng.y - targAng.y local angRate = 60 --Or whatever if diffP < 0 then finalP = angRate else finalP = angRate * -1 end if diffY < 0 then finalY = angRate else finalY = angRate * -1 end local finalAng = Vector(0,finalY,finalP) finalAng:Rotate(-1*extEnt:EyeAngles()) finalAng.x = 0 --I don't want it rolling physObj:AddAngleVelocity(finalAng) [/code] but it just goes slow in a random direction, then freaks out. Does anyone know what I may be doing wrong here?
Sorry, you need to Log In to post a reply to this thread.