Quantcast
Channel: Questions in topic: "javascipt"
Viewing all articles
Browse latest Browse all 1875

Getting error transform.position assign attempt for "Player" is not valid on rigidbody

$
0
0
I've seen others ask about this error and some say it appears in the editor only, some say it's because 1 or more of the Vector3 values is null. I can see in the debug that my project thinks the x and z values are null - but I don't understand why, this is a rigidbody and I don't calculate the Vector3 through my code. I use AddRelativeForce() & AddRelativeTorque() ![alt text][1] This error occurs when my player hits a wall in a specific part of a specific level. Could it be related to the bounce texture I have on my level mesh maybe? Honestly got no idea. Edit: kmgr wanted to see code so here's the most relevant bit. Like I said, I don't edit the Player's transform directly. Only the rigidbody. function FixedUpdate () { var moveHorizontal : float= Input.GetAxis ("Horizontal"); var moveVertical : float= Input.GetAxis ("Vertical"); if((moveHorizontal < 0) || Input.GetKey("a")) { GetComponent.().AddRelativeTorque (0,-rotationSpeed,0); } else if((moveHorizontal > 0) || Input.GetKey("d")) { GetComponent.().AddRelativeTorque (0,rotationSpeed,0); } if ((moveVertical > 0) || Input.GetKey("w")) { GetComponent.().AddRelativeForce (Vector3.forward * speed); } else if ((moveVertical < 0) || Input.GetKey("s")) { GetComponent.().AddRelativeForce (Vector3.back * speed); } } [1]: http://i.imgur.com/QGqPYWw.jpg

Viewing all articles
Browse latest Browse all 1875

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>