• Model facing the wrong way round
    6 replies, posted
Im making a rocket that fires out the car which works but the problem is that it is facing the wrong way round when I set the angles of the rocket to eye angles. How would I make it face the right way round? [Lua] function WeaponFire(ply, weaponId) if(weaponId > 0)then local weapon = weaponList[weaponId] if(weapon[3])then local pos = ply:GetShootPos() local ang = ply:GetAimVector() local tracedata = {} tracedata.start = pos tracedata.endpos = pos+(ang*100000) tracedata.filter = {ply, ply:GetVehicle()} tracedata.mask = SOLID local trace = util.TraceLine(tracedata) local car = ply:GetVehicle() local ent = ents.Create(weapon[2]) hitPos = trace.HitPos spawnPos = ent:SetPos(car:GetPos() + car:GetForward()*120 + Vector(0,0,30)) ent:SetAngles(ply:EyeAngles()) ent:Spawn() if(weapon[5] == 0)then ent:GetPhysicsObject():SetVelocity(ply:EyeAngles():Forward()*10000) elseif(weapon[5] == 1)then ent:GetPhysicsObject():SetVelocity(ply:EyeAngles():Forward()*(300 + car:GetVelocity():Length())+ Vector(0,0,500)) end else WeaponFireBack(ply, weaponId) end end end [/Lua]
Try multiplying ply:EyeAngles() by -1. [lua]ent:SetAngles(ply:EyeAngles() * -1)[/lua]
Iv tried that and it rotates as the car does in the yaw axies, I have no Idea why
Get a picture of the car flying and I'll give you working code.
Its not a flying car its a car which fires rockets as weapons heres a pic [Url]http://ioj.com/v/uehmk[/Url]
ent:SetAngles((ply:GetAimVector()*-1):Angle())
Thanks alot mate works perfectly
Sorry, you need to Log In to post a reply to this thread.