Box2D Forums

It is currently Wed May 22, 2013 3:58 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Tween joints
PostPosted: Tue Jul 05, 2011 7:14 am 
Offline

Joined: Tue Jul 05, 2011 7:08 am
Posts: 1
Hi,

Im new to the WCK and have spend most of my day fixing this little problem.

I three joints attached to a box (just like the PlatformSwing in the demo). What i want to do is to animate the box with manual keyframes, but still allow the physical rotation of the box.

I have tried with type of the box set to "Animated", but then it does not rotate anymore.

I have attached a drawing to show what i mean.

Any help is highly appreciated :)

Thanks!


Attachments:
box2d_question.jpg
box2d_question.jpg [ 16.44 KiB | Viewed 619 times ]
Top
 Profile  
 
 Post subject: Re: Tween joints
PostPosted: Thu Jul 07, 2011 10:54 am 
Offline

Joined: Mon Jun 13, 2011 2:52 pm
Posts: 18
@Chew I couldn't get a tween to work on a joint either. Maybe you could put the animated MC on top of the box and have it follow the b2Body as it swings. But you may get some lags (viewtopic.php?f=19&t=7251). Also matching the rotation could be a pain.

Hmm, I guess this post wasn't that helpful.


Top
 Profile  
 
 Post subject: Re: Tween joints
PostPosted: Fri Jul 08, 2011 7:44 am 
Offline

Joined: Fri Dec 14, 2007 8:07 pm
Posts: 913
This is a tough scenario to implement. My first thought is to set the two joints up as distance joints and then manually tweak the length of the distance joints to move it up and down like so:

Code:
(b2joint as b2DistanceJoint).m_length += 1;


Setting the length of distance joints isn't officially supported but I think it works.


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

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


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