Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Need help with sliding collision response

Guest
Dec 13, 2012 Dec 13, 2012

So, I am making a game, where the balls falls from above and depending on the nature of the object below it (straight/curved), it stops/slides from it.. I.e. if there is a curved path, it'd roll/slide in that direction.

I have done programming before, but I am pretty new to AS, so can anyone help me with it? Are there any good tutorials for anything like that?

TOPICS
ActionScript
479
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 13, 2012 Dec 13, 2012

To start simply, how simple are the curves?

You can easily apply a class to the lines that are flat so it signals the hit object to stop where it is.

On the curves, if you generate a random curve and need physics involved to animate your ball that's one thing. If all the curves are generally the same you can avoid employing a physics engine. It depends on your needs.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 13, 2012 Dec 13, 2012

I asked this same question in other forum and was given link of Box2D as a physics engine.

I started using it, but there's one thing I just can't understand.. If you have used Box2D, I hope you can help me..

I have curved lines like this (atleast the shape) -

http://img585.imageshack.us/img585/8571/lineuk.png

I am wondering, which shape does it fall in?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 14, 2012 Dec 14, 2012
LATEST

Sorry I haven't used Box2D but just from the front page you can clearly see it will do what you want. I didn't stick around there to check but you'd want to make sure that framework gets updated for Stage3D for the future. It feels very cpu-only right now.

The bridge demo shows you a curved surface with a ball (if you clean the rest off) that will roll along it, maintaining traditional physics:

box2d.JPG

I'd say it's a decent direction to go in as long as there's some future Stage3D support.

Otherwise look at Stage3D and consider picking one of the frameworks that has a physics system like Flare3D, Alternativa3D, etc.

Also keep in mind there's some good tools out there like the motionPath library from greensock ( http://api.greensock.com/as/com/greensock/motionPaths/package-detail.html ). Once you collide with a path you can use that library to set up a path for your object to animate across, like lines and curves. The physics would have to be added by hand but the class supports giving you control over the tween from start to finish so you could easily maintain your own objects "velocity" and animate along the paths using that for a speed.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines