Hi, im trying to create a script that will give the player the feeling he is in the water With a OnTriggerEnter function that will get the charactermotor script and change the gravity and fallspeed.
Would appreciate if i could get some tips or help.
This is what i get
NullReferenceException: Object reference not set to an instance of an object
SvimmingTest.Main () (at Assets/Daniels Script/SvimmingTest.js:16)
private var characterMotor : CharacterMotorDB;
function OnTriggerEnter (Water : Collider)
{
Debug.Log("Player is in the Water"); //The console shows the debug Message so this part Works
characterMotor = GetComponent(CharacterMotorDB);
}
characterMotor.movement.gravity = 2;
characterMotor.movement.maxFallSpeed = 3;
characterMotor.movement.maxForwardSpeed = 4;
characterMotor.movement.maxSidewaysSpeed = 4;
{
}