x


Pinball Joystick

Hello, I'm trying to build a pinball game. I'm following the script joystick.js present in the standard assets (mobile) where you create two virtual joystick. Unfortunately I can not implement motion with a joystick and other movement per second. I wish that when I press the joystick right to stand up and lower the right controller, but if I press the left rises the controller left.

This is the scripts that I need to simulate the movement of the controllers.

var commandKey : String;
var restPosition : float = 0F;
var pressedPosition : float = -1;
var configurableJoint : ConfigurableJoint;
private var isGoingToPressedPosition : boolean = false;
function IsGoingToPressedPosition : boolean {
    return isGoingToPressedPosition;
}
function GoToPressedPosition(){
    configurableJoint.targetRotation.z = pressedPosition;
    isGoingToPressedPosition = true;
}
function GoToRestPosition(){
    configurableJoint.targetRotation.z = restPosition;
    isGoingToPressedPosition = false;
}
}
function FixedUpdate(){
    if(Input.GetKey(commandKey)
        || (commandKey == "q" && Input.GetKey(KeyCode.LeftArrow))
        || (commandKey == "q" && Input.GetKey(KeyCode.RightArrow))) {
        GoToPressedPosition();
    }
    else {
        GoToRestPosition();
    }
}

Can anyone help me figure out how to integrate my code in the script joystick.js (found in standard assets (Mobile)), making sure that it works? thanks for the help

more ▼

asked Jul 16 '11 at 05:14 PM

Alexis_87 gravatar image

Alexis_87
-4 5 5 5

(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1999
x794
x576
x214

asked: Jul 16 '11 at 05:14 PM

Seen: 838 times

Last Updated: Jul 16 '11 at 05:14 PM