• How do i rotate a playermodel?
    4 replies, posted
I want to make a player model spin in a complete circle kind of like in thirdperson_mayamode except the game automates the rotation. How would I do this? Would I have to make a custom animation for the playermodel?
This kind of works: [code] spin2 = 0 function spin(cmd) if spin2 == 1 then RunConsoleCommand("thirdperson_mayamode") end if spin2 < 180 then cmd:SetViewAngles(Angle(LocalPlayer():GetAngles().x,LocalPlayer():GetAngles().y + 10 , LocalPlayer():GetAngles().z)) spin2 = spin2 + 1 print(spin2) end if spin2 == 180 then RunConsoleCommand("thirdperson_mayamode") end end [/code] but if I want to put it into a concommand like this it doesn't work [code] concommand.Add("spin", function() function spin(cmd) if spin2 == 1 then RunConsoleCommand("thirdperson_mayamode") end if spin2 < 180 then cmd:SetViewAngles(Angle(LocalPlayer():GetAngles().x,LocalPlayer():GetAngles().y + 10 , LocalPlayer():GetAngles().z)) spin2 = spin2 + 1 print(spin2) end if spin2 == 180 then RunConsoleCommand("thirdperson_mayamode") end end end) hook.Add("CreateMove", "spin", spin) [/code] I'm not really sure what to do
Use [URL="http://wiki.garrysmod.com/page/GM/CalcView"]CalcView[/URL].
I think he means the playermodel, i don't think theres a function to rotate playermodel itself, although you can create a shadow model that uses the player animations to mimic it and then you can control it and rotate it
I created a kind of shadow model that sets its position to the player: [code] concommand.Add("shadow", function(ply) local button = ents.Create( "prop_physics" ) if ( !IsValid( button ) ) then return end button:SetModel( "models/rtbmodels/pokemon/squirtle.mdl" ) button:SetAngles(Angle(ply:GetAngles() )) button:SetPos( Vector( ply:GetPos()) ) button:Spawn() button:SetCollisionGroup(COLLISION_GROUP_DEBRIS) ply:SetModelScale( 0,0) local function onThink() button:SetAngles(Angle(button:GetAngles().x,button:GetAngles().y + 10, button:GetAngles().z )) button:SetPos( Vector( ply:GetPos()) ) end timer.Create("removethink",1,1, function() hook.Remove( "Think", "Some unique name") button:Remove() ply:SetModelScale( 1,0) end) hook.Add( "Think", "Some unique name", onThink ) end)[/code] The model stutters whenever I move though. Is there any way to fix that?
Sorry, you need to Log In to post a reply to this thread.