Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Box2d and Spinning a Pinwheel — Gideros Forum

Box2d and Spinning a Pinwheel

VraminVramin Member
edited September 2013 in General questions
I'm trying to get a pinwheel spinning that feels natural and accelerates correctly. I have a body and then a propeller attached to it with a revolute joint. When you touch it I use a mouse joint to let you spin the fan by swiping. However, since you want to make it go a fast as possible, I need to be prepared to handle another swipe on the same sprite in short order.

Using the frequency and damping ratio I'm getting pretty close (feels better on iPad than iPhone at this point):
local jointDef = b2.createMouseJointDef(groundBody, touchedBody, x, y, 100000, 1.5, 0.0);
What I'm trying to is make sure that when you touch the sprite again and reconnect the mouse joint that it doesn't steal too much velocity from the fan so that the secondary swipe adds to the angular velocity.

Has anyone done this or know of any examples that might be helpful?

Comments

  • Hmm, but are you sure that you need mouse joint at all?
    I just don't know your exact goal, but you could simply check the length and speed of a swipe and apply it as angular velocity in correct direction?
  • VraminVramin Member
    edited September 2013
    I started out that way and have considered going back that direction. I would have to figure out if it was above or below, left or right of the center point and then apply the force in the right direction, but the mouse joint seemed more realistic, especially for slow movements. It's possible to swipe in the wrong direction and stall it out, etc.

    I haven't seen many examples that use the damping and frequency, so I've been experimenting with different values. On the iPad the settings above feel pretty natural, but on the iPhone it's not quite right.
Sign In or Register to comment.