hi,
im working on a simple jumpNrun testscene.
weird thing is, jumping (Arrow UP) works perfectly in the editor and webplayer but not on the standalone exe.
works/ doesnt work with joystick too.
Webplayer works:
deletedurl
standalone exe doesnt work:
deletedurl
my code:
var BUTTON_LEFT = false;
var BUTTON_RIGHT= false;
var BUTTON_JUMP= false;
var BUTTON_JUMP_DOWN= false;
private var jumping=450.0;
var collieded=0;
function Update () {
if (Input.GetKey(KeyCode.LeftArrow) || Input.GetAxis("Horizontal") < -0.5 ) {
BUTTON_LEFT = true;
}else{
BUTTON_LEFT = false;
}
if (Input.GetKey(KeyCode.RightArrow) || Input.GetAxis("Horizontal") > 0.5 ) {
BUTTON_RIGHT= true;
}else{
BUTTON_RIGHT = false;
}
if (Input.GetKey(KeyCode.UpArrow) || Input.GetKey(KeyCode.Joystick1Button0)) {
BUTTON_JUMP= true;
}else{
BUTTON_JUMP = false;
}
if (Input.GetKeyDown(KeyCode.UpArrow) || Input.GetKeyDown(KeyCode.Joystick1Button0)) {
BUTTON_JUMP_DOWN= true;
}else{
BUTTON_JUMP_DOWN = false;
}
//Buttons
///////////////////////////////////////////////////////////////
}
function FixedUpdate () {
rigidbody.AddForce (0, -35, 0);
rigidbody.angularDrag = 100;
if (BUTTON_LEFT) {
rigidbody.angularDrag = 0;
rigidbody.AddTorque(0, 0,30);
rigidbody.AddForce (-7, 0, 0);
}
if (BUTTON_RIGHT) {
rigidbody.angularDrag = 0;
rigidbody.AddTorque(0, 0,-30);
rigidbody.AddForce (7, 0, 0);
}
if (collieded==0) {
if (BUTTON_LEFT) {
rigidbody.angularDrag = 0;
rigidbody.AddTorque(0, 0,30);
rigidbody.AddForce (-30, 0, 0);
}
if (BUTTON_RIGHT) {
rigidbody.angularDrag = 0;
rigidbody.AddTorque(0, 0,-30);
rigidbody.AddForce (30, 0, 0);
}
}
if (BUTTON_JUMP_DOWN) {
jumping = 450;
}
if (BUTTON_JUMP) {
jumping = jumping-40;
if (jumping <= 0) {
jumping = 0;
}
rigidbody.AddForce (0,jumping, 0);
}
}
function OnCollisionStay() {
collieded=1;
}
function OnCollisionExit() {
collieded=0;
}