Jump to content

[LUA] rotate box along with camera


dennis
 Share

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...