Is it possible to rotate b2RevoluteJoint by reverse way? - rotation

I'm making a flapping bird in a box2d world.
I want to make flapping action of bird's wings.
Wings are rotated one way(using motor) and get forced the other way like flapping.
But if I rotate wings, it rotate to bottom. So I want to make it reverse way.
Is there a way to do it?
Any opinion is helped.
Thanks.

Related

scratch bounce then upside down

Above you can see my Scratch workspace where the ship on the left is upside down when it is running, and IT IS THE SAME CODE.
Is it a bug of scratch or some kind of other problem?
Make sure that the sprite is set to don't rotate in the info tab
Alternatively, you can add the set rotation style to (don't rotate).
It will make the sprite no longer rotate all around.
Otherwise, if you want to make it look like it is walking rather than just looking in a direction while walking, replace the parameter don't rotate to left-right
I use Scratch 2 for kids programming classes and as a beginner at this object, at first I had the same problem that confused me a lot as to what would provoke the Sprite to turn around.
It turned out that Scratch makes the character rotate when it bounces off the edge (I guess that the reason is not functional).
Anyway to solve it I added the move->set rotation style (don't rotate) before (the position doesn't matter, could as well place it after) the if on edge bounce block.

Is it possible to control the 3D animation's movement in Unity script?

I have this golfer animation. It is quite smooth movement ant the best I can find in golfer animation.
But its movements are always the same pattern.
For example, if I like to use the model to represent real person's movements outside in playing golf. Is it possible?
That means, can I control the club's 3D position and orientation in animation from script?
You could use Inverse Kinematics (https://docs.unity3d.com/Manual/InverseKinematics.html)
With this you attach the hands on the club and move the club as you want :
The hands / arms and close bones with follow it in a "realistic" way while the rest of the body will be animated as usual.
However the club movement will need some work to get a nice feeling like your original animations.
Target Matching (https://docs.unity3d.com/Manual/TargetMatching.html) could be useful too or even better but I never used that.

How to change rigs spine rotation in unity3d, using camera rotation?

I have a rigged 3d model of a person with animations that i made. It is a player model in a first person shooter. I want this model to "bow", when looking down or do the opposite, when looking up. To achieve this, i decided, instead of making an animation for each degree the player might decide looking at, to rotate models spine, depending on the angle of the camera. In scene view, i can easily change rotation value and get the results i want, however, when game is running, those parameters seem to be "locked" and no matter what script i tried, i cant seem to change the rotation value. I figured, perhaps, when animation is playing, i cant change things it effects, so made a body mask to excluded torso from animations and spines rotation was still locked away from me. Is there a way to rotate models spine, when its doing its normal, lets say, idle, animation? is there actually another easy way to achieve this?
You have to update in LateUpdate(). Unity's animator does it's changes to the transform in Update(). By doing it in LateUpdate() it will be handled after the animation has made it's changes.

How to animate order in layer with keyframe in animation dopesheet in Unity3D?

I can use keyframe animation on Position, Rotation, Scale and even Material, is there anyway i can animate the order in layer for a particular sprite without using code?
I was trying the same thing yesterday and havent found an easy way yet. One approach might be to set AnimationEvents and change the order that way. Write an answer here if you find a better way :)

How do I animate clouds?

I have 3 nice and puffy clouds I made in Photoshop, all the same size, now I would like to animate them so they appear like they were moving in the background. I want this animation to be the base background in all my scenes (menu,settings, score, game).
I'm using cocos2d, I have setup the menus and the buttons so the work but how do I accomplish this?
I was thinking to add this as a layer, any other suggestions?
Can anyone show me how some code how to make this please?
David H
A simple way to do it is with sine and cosine. Have slighly different parameters (period and amplitude) to ensure that the user doesn't realise (as easily) that they are programmatically animated.
You may also want to play with animating the opacity value. I'm not sure if layers have those, otherwise you'll have to add the clouds to separate nodes or images and applying it to them.
It's hard to be more specific without knowing what the images look like.
The simplest way to animate anything is to add the sprite to the scene, set the position and call something like...
[myClouds runAction:[CCMoveBy actionWithDuration:10 position:CGPointMake(200, 0)]];
This will slide the sprite 200px to the right over 10 seconds. As Srekel suggested, you can play around with some trig functions to get a more natural feel and motion paths, but you'll have to schedule a selector and iteratively reposition the elements.
The more difficult part of your questions is about getting the animation in the background of all scenes. Keep in mind that when you switch scenes, you're unloading one node hierarchy and loading a new one. The background cannot be shared. You CAN, however, duplicate the sprites and animation in all scenes, but when you transition between them there will be a jump.

Resources