Gentlemen.
Currently, I’m writing up my own, simpler movement code for use in my projects, and have run into a snag. I’ve a bit of code that uses a Ray to check whether there’s ground beneath you, altering an onGround variable to true or false based on its findings:
var onGround : boolean;
if(Physics.Raycast(transform.position, -transform.up, 1)) {
onGround = true;
}
else {
onGround = false;
}
This bit works just fine when the script is attached to a random cube, but doesn’t seem to DO anything when I attach it to an FBX model I exported from Messiah Studio. Another issue is the movement part of the code:
rlMovement = Input.GetAxis("Horizontal");
if (rlMovement) {
transform.Translate(transform.right * rlMovement * Time.deltaTime * moveSpeed);
if(Input.GetButtonDown("Dash"))
rigidbody.AddForce(Vector3(5 * rlMovement, 0, 0), ForceMode.Impulse);
}
When attached to a cube, it works just fine; Pressing D moves it right, pressing A moves is left. But when attached to said Messiah model, the movement is reversed. Are the axes getting screwed up on export or something? Should I take the issue to a Messiah-based forum instead?
~FIXED~
So I was able to fix the second issue by messing with the centers and whatnot in various export settings that it went through. Good solution, understandable enough. But the first issue was solved by… Adding another, completely unrelated boolean variable. Which is rather odd, to say the least…