PcWizKid Posted March 26, 2010 Share Posted March 26, 2010 i have made a door model in blender and textured it and everything but now this is what i need: You walk up to the door and it displays a message on the screen "Press E to use" then when you press E the door opens. how might I do this? thanks, Garrett Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted March 26, 2010 Share Posted March 26, 2010 You can do this with a raytrace. I've tried to do this before by showing a hand icon on special objects, but I never got it working on purely the models I wanted it 2. place this in the main loop, before FW:Update. pick=CameraPick(camera,Vec3(GraphicsWidth()/2,GraphicsHeight()/2,2.0),0,0) if pick~=nil then repeat if pick.entity:GetClass()==ENTITY_MODEL then break end pick.entity=pick.entity.parent until pick.entity==nil if pick.entity~=nil then showText =1 end end and then before the flipp command SetBlend(1) if showText == 1 then DrawText("Press E to open door"GraphicsWidth()/2,GraphicsHeight()/2) end SetBlend(0) or instead of a raytrace you can use EntityDistance: if EntityDistance(fw.main.camera,door) <2 then --showText=1 end You can then either have code to rotate the door on it's Y axis or you play an animation. Quote Link to comment Share on other sites More sharing options...
PcWizKid Posted March 26, 2010 Author Share Posted March 26, 2010 ok i did everything u said but an error comes up saying "failed to open Fpscontroller.lua" And then amother saying " ')' expected near 'GraphicsWitdth' " P.S I also saw the "VisualKnights Developer Diary - 1 - Mission Tab" video. It looks great!! Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted March 26, 2010 Share Posted March 26, 2010 Here is an adjusted fpscontroller. It shows you text when you are near an object and no text when you are not. I am still truying to make lua script that you can add to objects. This way the text only opens when you for example have turned on an option for the lua model. and thanks for your comment on the video fpsICON.zip 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.