Box2D Forums

It is currently Mon May 20, 2013 1:57 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: Sat Mar 12, 2011 7:20 am 
Offline

Joined: Sat Mar 12, 2011 7:16 am
Posts: 8
I just started the tutorial on using the WCK, but when i reached this step, it didnt work properly:
Quote:
Create a Simple Body Containing Multiple Shapes

Create a new symbol with a base class of wck.BodyShape. Within this symbol place two boxes so that they overlap, but are not completely on top of each other. Try rotating, scaling, or skewing them. What you are creating is a body (the symbol with base wck.BodyShape) that contains two shapes (the two transformed boxes). When done, drag your new body symbol into your world.

Drag another instance of this body symbol into your world and try scaling, skewing, and rotating it so it looks drastically different than your first body instance.

Debug your project. The shapes within each body symbol should move as if they are one body. The transforms (skew, scale and rotation) you applied to your symbols should also correctly translate into the physics simulation.

What happens, is that the movieclip, with baseclass and component definition class wck.BodyShape, containing the two rectangles, just falls straight down through the bottom ...

what am i doing wrong?


Top
 Profile  
 
PostPosted: Tue Mar 15, 2011 2:37 am 
Offline

Joined: Mon Apr 26, 2010 5:35 am
Posts: 20
Are you getting any errors in the output window? If you have set the shapes within the movieclip to be a sensor they would fall through the floor.

Normally if I have anything falling through the floor its because I have set them as either a sensor or there is an error. Possibly if you have adjusted the maskbits/categorybits then that might be the cause - but this is unlikely in your case.


Top
 Profile  
 
PostPosted: Tue Mar 15, 2011 5:51 am 
Offline

Joined: Sat Mar 12, 2011 7:16 am
Posts: 8
engiebenjy wrote:
Are you getting any errors in the output window? If you have set the shapes within the movieclip to be a sensor they would fall through the floor.

Normally if I have anything falling through the floor its because I have set them as either a sensor or there is an error. Possibly if you have adjusted the maskbits/categorybits then that might be the cause - but this is unlikely in your case.

No i didnt get any output errors.
what i did was draw two rectangles, select both and convert to symbol
i set the class to wck.BodyShape, aswell as the comp. definition
but it just falls down :S


Top
 Profile  
 
PostPosted: Tue Mar 15, 2011 6:39 am 
Offline

Joined: Mon Apr 26, 2010 5:35 am
Posts: 20
So you want two rectangles to be in the same body? :?

Okay I suggest you make a movieclip with the baseclass wck.BodyShape, inside this add two rectangles, both should have the baseclass shapes.Box the class will be generated on export and you can name it whatever you wish.


Top
 Profile  
 
PostPosted: Tue Mar 15, 2011 7:22 am 
Offline

Joined: Sat Mar 12, 2011 7:16 am
Posts: 8
engiebenjy wrote:
So you want two rectangles to be in the same body? :?

Okay I suggest you make a movieclip with the baseclass wck.BodyShape, inside this add two rectangles, both should have the baseclass shapes.Box the class will be generated on export and you can name it whatever you wish.

Ah ok, i drew two rectangle shapes and put them in one movieclip, as a complex shape. but that didnt work.

So i need to add each part of a complex shape in a seperate movieclip, with its own basic shape class?

sorry if i sound a bit stupid here, but i just started using Box2D, and i find it really complex and hard to learn...


Top
 Profile  
 
PostPosted: Tue Mar 15, 2011 8:07 am 
Offline

Joined: Mon Apr 26, 2010 5:35 am
Posts: 20
Yes i think this is correct, its also a good idea to enable debug draw so you are able to see the actual physics boxes while your testing out different stuff. You should also center align any rectangles that you convert to a movieclip so that the physics box matches up correctly.


Top
 Profile  
 
PostPosted: Tue Mar 15, 2011 8:52 am 
Offline

Joined: Sat Mar 12, 2011 7:16 am
Posts: 8
ok thanks for the tips
i already knew about center aligning, but how do i enable debug drawing?


Top
 Profile  
 
PostPosted: Wed Mar 16, 2011 2:28 am 
Offline

Joined: Fri Feb 12, 2010 2:24 am
Posts: 51
On your WCK.World component properties panel you got a tick box that says "Debug draw". Click on that and it should do the job.
Awesome start, keep up!

GF


Top
 Profile  
 
PostPosted: Wed Mar 16, 2011 3:02 am 
Offline

Joined: Sat Mar 12, 2011 7:16 am
Posts: 8
thanks ^^

perhaps you can help with my other question aswell? viewtopic.php?f=19&t=6557


Top
 Profile  
 
PostPosted: Wed Mar 16, 2011 3:09 am 
Offline

Joined: Fri Feb 12, 2010 2:24 am
Posts: 51
hmm.. sorry but other question is beyond me :)
Regards :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 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