- Home /
Changing FPSController values via C#?
Hello,
I'm trying to change some FPSController values under certain conditions. Primarily when underwater, I have a detection script setup which changes fog colour and such when under a certain y position but want to know how I can reference other Javascript elements from C#.
I have my underwater.cs script attached to my main camera. Here are the things I want to effect:
CharacterMotor.js gravity = 0
Need some buoyancy, what could I change to simulate this? Gravity = -1 makes you rise but the movement keys make that more apparent. Not really sure what to do?
How can I change the character controller so I can move in all directions rather than just left and right?
Just to put this into perspective:
void SetUnderwater ()
{
RenderSettings.fogColor = underwaterColor;
RenderSettings.fogDensity = 0.01f;
//CharacterMotor.gravity = 0;
//Buoyancy
//Movement directions
}
Thanks for your time!
Answer by tw1st3d · Jul 09, 2013 at 08:05 PM
I'm no expert on the subject, but I believe you must use the same language to access a specific script, due to C# and JS/US using different syntax. Don't forget that you can use both languages in a game.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Accessing variables from scripts issues 1 Answer
how to use matrice with unity 3D 1 Answer
C# Gravity Gun. Error CS0120 2 Answers