- Home /
This post has been wikified, any user with enough reputation can edit it.
Script error HELP
So i keep getting a weird error that i don't have it set or something Error is:NullReferenceException: Object reference not set to an instance of an object Boo.Lang.Runtime.RuntimeServices.InvokeBinaryOperator (System.String operatorName, System.Object lhs, System.Object rhs) Water Physics.Update () (at Assets/Scripts/Water Physics.js:13) I have no idea what it means my code:
//deathnadosharkgames
var waterLevel : float;
var floatHeight : float;
var bouncedamp : float;
var offtheset : Vector3;
private var forcefactor : float;
private var actionpoint : Vector3;
private var uplift : Vector3;
function Update () {
actionpoint = transform.postion + transform.TransformDirection(offtheset);
forcefactor = 1f - ((actionpoint.y - waterLevel) / floatHeight);
if(forcefactor > 0f) {
uplift = -Physics.gravity *(forcefactor - rigidbody.velocity.y * bouncedamp);
rigidbody.AddForceAtPosition(uplift, actionpoint);
}
}
Comment
Wiki
Answer by Nemrav · Nov 29, 2014 at 09:19 PM
Null reference exception is when something in your script is referring to a thing which doesn't exist.
line 13:`actionpoint = transform.postion + transform.TransformDirection(offtheset);` note, transform.postion that is probably what it's complaining about.