havenphillip Posted September 23, 2018 Share Posted September 23, 2018 How can you rotate one thing in PostRender() without rotating everything? Is there a way without using shaders? Quote Link to comment Share on other sites More sharing options...
havenphillip Posted September 23, 2018 Author Share Posted September 23, 2018 Oh wait, I think I'm getting it. Quote Link to comment Share on other sites More sharing options...
havenphillip Posted September 23, 2018 Author Share Posted September 23, 2018 Nope. I got the square moving all over the screen but it won't turn. Here's my script: Script.pos = Vec2(242,234) -- Vec2 "Position" Script.offset = Vec2(4,3) -- Vec2 "Offset" Script.csize = Vec2(200,200) -- Vec2 "Size" Script.square = Texture:Load("Materials/Developer/bluegrid.tex") function Script:PostRender(context) Time:Update() local a = Time:GetCurrent()*0.1 local x = self.pos.x local y = self.pos.y local w = self.csize.x local h = self.csize.y local scale = 1 --context:SetRotation(a) context:SetScale(scale,scale) context:SetBlendMode(Blend.Alpha) context:SetColor(1,1,1) context:DrawText(text,x,y) context:DrawImage(self.square, x-(Math:Cos(a)*(w) - Math:Sin(a)*(h)), y+(-Math:Sin(a)*(w) - Math:Cos(a)*(h)) , self.csize.x, self.csize.y) context:SetBlendMode(Blend.Solid) end Quote Link to comment Share on other sites More sharing options...
havenphillip Posted September 23, 2018 Author Share Posted September 23, 2018 I see. You have to reset context:SetRotation(0) at the bottom. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.