Jump to content

Making objects unvisible when character is under them[Lua]


Slastraf
 Share

Recommended Posts

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

post-12189-0-49201100-1419109110_thumb.jpg

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

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...