Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flash cs5 strokes(curvelines) to box2d static object. #18

Open
vamsibalu2 opened this issue Mar 31, 2013 · 3 comments
Open

Flash cs5 strokes(curvelines) to box2d static object. #18

vamsibalu2 opened this issue Mar 31, 2013 · 3 comments

Comments

@vamsibalu2
Copy link

Hi Jesses,
I have been struggling to get best approach to convert flash cs5 line drawings to box2d objects.
As per the Demo that was used base class as LineArc90, LineArc270.. etc.
I have bike racing path something like attached image, how can i divide this path to different moviclips and assign the base class to particular line (LineArc90, LineArc270).

Can't i take whole path as movieclip and assign the base class like Line or whatever.
path
Anyway you have done a great job. I really appriciate your great work.
Pls help me as Iam worrying about my game.

Thanks Bala

@jesses
Copy link
Owner

jesses commented Apr 3, 2013

You class should extend BodyShape since you don't want to use one of the prebuilt shapes in the shapes.* package.

Select one of your paths, then run the "Trace Edges.jsfl" script in the script folder. This will output the points on your curve to the output panel.

Then override the shapes method in your level class and call the edges(vertices:Vector.) function, passing the vertices output by the script.

Looking at this... I'm surprised I never wrote any convenience method to convert the output from the "Trace Edges" script to a vector of V2s to send to the edges() function, but that should be pretty easy to write.

@vamsibalu2
Copy link
Author

Thanks for your reply,
The problem here is Trace Edges give us the outline points of the shapes, but in above scenorio it's already a outline,
Again we have to convert above flash lines to shape and then only run traceEdges will give points.
In my knowledge edges(vertices:Vector) will draw lines by given Vector right. so in that case this will draw lines around our flash lines that is not iam expecting.
wck linedraw

It should draw a line as it is.

@jesses
Copy link
Owner

jesses commented Apr 4, 2013

Ok, see how you just drew the "ideal" points above your shape (the red line with yellow dots)? Do that in a new layer in flash, then run the "Trace Edges" script on THAT. Once you have your points you can delete the layer (or just hide it).

Since the points used by flash are not necessarily the ones you want to feed to Box2D, you've got to get a little clever and guide it sometimes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants