x


Using Configurable Joints to create Pinball Flippers?

So, for a while I have been trying different methods of making pinball flippers for my game. After a ton of trials and a some reading I am pretty sure that Configurable Joints will be the best way of making a pinball flipper. I know I have to set the target rotation and have the joint rotate to that point, but I'm not sure how since Quaternions confuse me. I was wondering if anyone could recommend a good way to use the joint to make it a flipper or how to set the target rotation.

Thanks

more ▼

asked Oct 06 '10 at 01:27 AM

Heratitan gravatar image

Heratitan
314 20 22 29

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

3 answers: sort voted first

Configurable Joints are really overwhelming unless you are willing to go through and figure out what properties you need. My character in my current game uses them, and it took forever to actually set up the motion. If you do, then here would be the steps.

  1. Set the rotation mode for y/z to position, and set the properties to be whatever speeds you want.

  2. In your Script, you don't really need to know almost anything about Quaternions. Just use Quaternion.AngleAxis(desiredRotation, Vector3.up); Then use GetComponent to find your configurable joint and change the target rotation to that Quaternion and it will "flap" itself to that angle at the force your properties defined. You probably want world space (Use World Space [check]) so you might have to transform the rotation based on the flappers up direction. i.e. Transform.up. Now, I always use world space, but you could use local space to as long as you account for rotating the object in the scene view.

  3. Then set the target rotation to Quaternion.Identity to reset your flapper.


Now, what I would do to save yourself a lot of time is to just use a hinge joint. Configurable joints are for when you have a specialized movement such as a complex character that is still physics controlled.

Hinge joints will let you specify a target rotation and the amount of force to move to it. Then, all's you have to change is the desired angle, no eulers or quaternions ore Vectors, just floats :).

And, given a flapper's movement is on a hinge, you would just end up spending extra time working out that behavior in a configurable joint.

Plus, hinge joints are easier to look at in the inspector. Configurable joints have so many properties that especially if you only use a few, you still have this blocky mass to go through when you want to tweak something. Which, all the properties have a useful purpose, but most objects will not use all of them at one time.

more ▼

answered Oct 06 '10 at 02:43 AM

Peter G gravatar image

Peter G
15k 16 44 136

Thanks I'll try this out.

Oct 06 '10 at 03:27 AM Heratitan

Thanks, you rock

Oct 06 '10 at 10:08 PM Heratitan
(comments are locked)
10|3000 characters needed characters left

I'm doing the same pinball project, and trying to use Hinge Joints.

The issue i find is that the min and max angles do not limit the movement, they just act sort of gravity wells, dragging the object slowly to the position, causing a lot of bounciness (my bounciness config at the inspector are all Zero).

To move the flipper fast enough you have to apply a large force to the rigidbody, making the object to pass the max angle.

If anyone could just shed some light on a particular config that make the hinge joint behave like a real flipper would help.

more ▼

answered Apr 20 '11 at 08:02 PM

GeorgeRigato gravatar image

GeorgeRigato
157 4 6 9

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

It might help to up your max angular velocity in the physics manager ! This will let your flipper flip much faster :O)

more ▼

answered Jan 03 '12 at 11:44 PM

LS16BMX gravatar image

LS16BMX
63 9 9 12

(comments are locked)
10|3000 characters needed characters left
Your answer
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:

x2171
x442
x243
x64
x12

asked: Oct 06 '10 at 01:27 AM

Seen: 3251 times

Last Updated: Jan 03 '12 at 11:44 PM