Pregunta

I got a question regarding using Nape Physics with Actionscript 3.0. I have a concept which involves 20-300 of balls appear on the screen with no gravity. With no gravity I mean that there is nowhere where the ball will fall too. Just see it like it's on a flat surface.

What I plan to do with these balls is that you can drag them and interact with them on a touch screen. Of course when you drag a ball I want there to be collision present.

I have built a test with Nape already but I'm currently not sure if I want to go Nape all the way.

The demo is here: http://www.bobharing.nl/Totems&Docks/index.html

With these balls I also plan to change their size, apply attributes to them, make them have their own action pattern and make balls with a certain attribute move to a certain location.

My question is: Should I go on with Nape Physics or go with self applied formulas? What I am trying to avoid is that late in the project a certain thing can't be done with Nape and then I'm back to square one.

¿Fue útil?

Solución

Nape makes life much easier but if you want to get the best performance certainly make your own mechanism for enter-balls collisions. There is a book called "Foundation ActionScript Animation: Making Things Move" by Keith Peters that I read a time ago, it includes a chapter called "Billiard balls physics". You might want to look at it, here is a link to the book: http://www.amazon.com/gp/product/1590595181/sr=8-1/qid=1153497977/ref=pd_bbs_1?ie=UTF8

Otros consejos

I have build something of that sort on Python .

I used visual Python and created objects called balls which had parameters as radius , the density was constant . The physics of a solid ball is very simple and you can code it by using the reflective laws of light but with a small loss in velocity.

I think for the point and pull feature you better use pygame library, it being 2d it is faster at rendering when compared with visual Python.

All you have to do is to compare the relative positions of the objects to predict if there would be a collision.

But for a flat surface such as a box the whole physics is slightly different so you will have to account for a lot of factors such as

1)velocity 2)moment of intertia 3)angle of collision 4)point of collision .....

Anyways this is an interesting problem Share the GitHub link once you are done

Best of luck

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top