• How do you rotate DrawSphere?
    3 replies, posted
Simply put, there is no function to set the angle of the sphere you are drawing, so how do you rotate it?
The reason there isn't a function for it is because it's really supposed to be a perfectly smooth sphere, but I guess if you lower the sphere's quality enough you could find a use for rotation. Perhaps there's another function in the render library that rotates, but I can't seem to find one since I suck at it
You should be able to create a Matrix and use [url]https://wiki.garrysmod.com/page/cam/PushModelMatrix[/url] [url]https://wiki.garrysmod.com/page/cam/PopModelMatrix[/url] Like so: [code] function ENT:Draw() local mat = Matrix(); mat:SetAngles(Angle(0, RealTime() * 10, 0)); -- Just set your angles here cam.PushModelMatrix(mat); render.SetColorMaterial() render.DrawSphere( self:GetPos(), 50, 30, 30, Color( 0, 175, 175, 100 ) )--From the wiki cam.PopModelMatrix(); end [/code] See [url]https://wiki.garrysmod.com/page/Category:VMatrix[/url] for more functions attached to the VMatrix class.
[QUOTE=Brassx;51636335]You should be able to create a Matrix and use [url]https://wiki.garrysmod.com/page/cam/PushModelMatrix[/url] [url]https://wiki.garrysmod.com/page/cam/PopModelMatrix[/url] Like so: [code] function ENT:Draw() local mat = Matrix(); mat:SetAngles(Angle(0, RealTime() * 10, 0)); -- Just set your angles here cam.PushModelMatrix(mat); render.SetColorMaterial() render.DrawSphere( self:GetPos(), 50, 30, 30, Color( 0, 175, 175, 100 ) )--From the wiki cam.PopModelMatrix(); end [/code] See [url]https://wiki.garrysmod.com/page/Category:VMatrix[/url] for more functions attached to the VMatrix class.[/QUOTE] Thank you for your help! I asked this for lua, but knew I'd be able to translate it to Starfall. Thanks again! Here's the result: [url]http://i.imgur.com/lqzLo3q.gif[/url]
Sorry, you need to Log In to post a reply to this thread.