Slastraf Posted December 20, 2014 Share Posted December 20, 2014 Hello My problem is that I cant code with Lua that good, and setting up basic mechanics in my game is hard for me. So lets get to one of them; I have a camera attached to an modificated fps script to the character controller, which lets you see the character(-model) from a "bird" perspective. my problem now is , that I cant see the playermodel when its under an Object. Can you guys help me making a script that automatically makes a Object(maybe a roof-> in this case a orange box) invisible so it lets you see the character model , when the camera cant see the player ? In this case the roof is a orange box.(take a look at the screenshot) regards, Friedrich Betz Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted December 21, 2014 Share Posted December 21, 2014 One way to do this is send a raycast from the camera to the player. When the ray doesn't hit the player, hide the entity that it hits instead. Quote Link to comment Share on other sites More sharing options...
Slastraf Posted December 21, 2014 Author Share Posted December 21, 2014 One way to do this is send a raycast from the camera to the player. When the ray doesn't hit the player, hide the entity that it hits instead. Yes , taught about that, too. but how do you set this up in lua? Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted December 21, 2014 Share Posted December 21, 2014 Roof script: seta key for the roof with SetKeyValue("structure", "roof") have a temp variable that stores the original material of the roof. Have a inivisble material. camera script: send raycast every 0.3 seconds The raycast kits an entity and checks if GetKeyValue("structure") is equal to "roof". if so, store the roofs material in the temporary variable. Apply the invisble material next. Once you have that, you can take a look in to reapplying the original material once the raycast no longer hits the roof. Quote Link to comment Share on other sites More sharing options...
Slastraf Posted December 21, 2014 Author Share Posted December 21, 2014 Roof script: seta key for the roof with SetKeyValue("structure", "roof") have a temp variable that stores the original material of the roof. Have a inivisble material. camera script: send raycast every 0.3 seconds The raycast kits an entity and checks if GetKeyValue("structure") is equal to "roof". if so, store the roofs material in the temporary variable. Apply the invisble material next. Once you have that, you can take a look in to reapplying the original material once the raycast no longer hits the roof. many thanks to the reply. am going to try this now 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.