dennis Posted March 16, 2015 Share Posted March 16, 2015 heya guys, a few months ago I created a part in my script where I draw a box and position it at the camera, on movement it moved along with me and on turn it turned with the camera, always facing the same direction. since I lost that script, because of my poor backup (and the engine updated).. I am not able to achieve it anymore, can someone help me with this ? as seen here: http://www.indiedb.com/games/banned/news/inventory-and-hud cheers Quote Link to comment Share on other sites More sharing options...
Ma-Shell Posted March 16, 2015 Share Posted March 16, 2015 Just parent the box to the camera. No code needed. Quote Link to comment Share on other sites More sharing options...
beo6 Posted March 16, 2015 Share Posted March 16, 2015 after an update your script should not be lost. You should look for .bak* files in the project folder if you can find it. Quote Link to comment Share on other sites More sharing options...
dennis Posted March 17, 2015 Author Share Posted March 17, 2015 Just parent the box to the camera. No code needed. I know, but I want it to do using code, easier to do... because I have more scenes to deal with, and I don't feel like setting those up. still thanks though after an update your script should not be lost. You should look for .bak* files in the project folder if you can find it. Still can't find it, there was a strange bug at my side. it was totally lost Quote Link to comment Share on other sites More sharing options...
shadmar Posted March 17, 2015 Share Posted March 17, 2015 box->SetParent(camera); Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
dennis Posted March 17, 2015 Author Share Posted March 17, 2015 Hey shad, Already did that, ain't working. here's the code I'm using: BarL = Model:Box(1,0.5,0) BarL:SetParent(self.camera,false) BarL:SetColor(1,1,1,1) BarL:SetPosition(-1.3, -0.55, 1.2) BarL:SetRotation(35,-85,0) BarL:SetShadowMode(0) local BarLMat = Material:Load("Materials/HUD/maindisp/hud_bottom_energybars/hude_10.mat") BarLMat:SetDepthTestMode(false) BarL:SetMaterial(BarLMat) BarL= Model:Create() problem is, it won't rotate with the camera. it first did, but since LE 3.4 it doesn't. Cheers Btw, that is for the left side, since the Hud is built in several parts Quote Link to comment Share on other sites More sharing options...
shadmar Posted March 17, 2015 Share Posted March 17, 2015 This works for me: BarL = Model:Box(1,0.5,0) BarL:SetPosition(self.camera:GetPosition(true)+Vec3(0,0,2)) BarL:SetParent(self.camera) Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
dennis Posted March 17, 2015 Author Share Posted March 17, 2015 Where did you placed it? function Script:Start() ? or somewhere else ? 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.