Box2D Forums

It is currently Fri May 24, 2013 1:56 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Wed Mar 16, 2011 6:07 am 
Offline

Joined: Tue Mar 15, 2011 4:12 am
Posts: 5
Hi guys,

I have a box with a joint on it (with motorEnabled = true on the joint). Turning the motor 'on' makes the box move like a 'fan', which is all good.
Now, I would like to tween this 'fan' from one position to another (say...left to right).
So, what I do is I put these two components (box and the joint) inside a Movieclip and I manually tween this movieclip.
I set the 'tweened' property of both these component to 'checked'.

Unfortunately, I end up getting this error. Just wondering if there is any way to achieve this effect?

Code:
Assertion failed: (b1->m_invI > 0.0f || b2->m_invI > 0.0f), function InitVelocityConstraints, file ../Box2D/Dynamics/Joints/b2RevoluteJoint.cpp, line 73.

[object AlchemyExit]
   at Function/<anonymous>()
   at Function/<anonymous>()
   at Box2DAS.Dynamics::b2World/HandleStep()
   at flash.events::EventDispatcher/dispatchEventFunction()
   at flash.events::EventDispatcher/dispatchEvent()
   at Box2DAS.Common::b2EventDispatcher/dispatchEvent()
   at Box2DAS.Dynamics::b2World/Step()
   at wck::World/step()


I guess I am doing something wrong here.

Attached is the effect I would like.

Thank you, folks.


Attachments:
box joint motor on.png
box joint motor on.png [ 3.21 KiB | Viewed 861 times ]
Top
 Profile  
 
PostPosted: Wed Mar 16, 2011 11:28 am 
Offline

Joined: Sat Mar 12, 2011 7:16 am
Posts: 8
perhaps setting the type to Kinematic might work?


Top
 Profile  
 
PostPosted: Sat Mar 19, 2011 5:10 pm 
Offline

Joined: Fri Dec 14, 2007 8:07 pm
Posts: 913
The "tweened" property for Joints only applies to mouse joints. It indicates that you intend to animate the mouse joint. A tweened mouse joint along with setting angular velocity might achieve the effect you want.

Another approach would be to connect the revolute joint not to the ground but another body of type = Animated, then tween that.


Top
 Profile  
 
PostPosted: Sun Mar 20, 2011 4:41 am 
Offline

Joined: Tue Mar 15, 2011 4:12 am
Posts: 5
@Prot0wNix:
Thank you for the reply, Sir. However, it didn't work. Perhaps, I just don't know too much about setting things with Kinematic options.



@mayobutter:
Thank you, Sir.
Quote:
Approach 1) A tweened mouse joint along with setting angular velocity might achieve the effect you want.

I didn't quiet understand how to go about this one. I couldn't find any angular velocity setting on the tweened mouse joint (on the component inspector panel). I did try a 'tweened mouse joint' (i.e., 'tweened' set to 'true' and type set to 'Mouse' on that joint) and it would just move the box (on which the joint is attached) along the manually tweened path (of the joint), but somehow, setting the 'enableMotor' had no effect on the box, i.e., there was no 'fan' effect. It just felt like an object that is tweened with type set to 'Animated'. However, the box to which the joint is attached did move a little up and down along the path - kinda wobbly movement, which I may add looked pretty cool too :lol:, and I included this tween effect in my game as well! haha
Perhaps, I didn't do things properly to follow this approach.

Quote:
Approach 2) Another approach would be to connect the revolute joint not to the ground but another body of type = Animated, then tween that.

Now, this worked just as I wanted it to work. Perfect!
Thank you.


Top
 Profile  
 
PostPosted: Sun Mar 20, 2011 4:48 am 
Offline

Joined: Tue Mar 15, 2011 4:12 am
Posts: 5
While we are at it, I might ask one more question.

If I set the 'density' of the box (to which the joint is attached), to say, 20...the box just drops down. It doesn't follow the joint along the tween path.

I am guessing that the joint is not strong enough to hold such a heavy object.
So, how does one make the joint stronger?

Many thanks.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group