A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: Terrain Collision?

  1. #1
    Senior Member Zoranan's Avatar
    Join Date
    May 2008
    Posts
    126

    Terrain Collision?

    I'm not sure how to do terrain collision detection in 3dfa. I've done what most other tutorials say to do, but it doesn't work on 3dfa. Does it require flash 8 or 9? does it matter. I am kinda lost, so any help would be great

  2. #2
    A Senior Newbie - How Odd ForumNewbie's Avatar
    Join Date
    Mar 2003
    Posts
    590
    Hi,

    It might be best to post an example of what you've been able to do so far so we can see where you're going wrong

    Cut the example back to be as simple as possible, so we can see the problem clearly, without getting distracted by the rest of the movie

    Are you trying to do this via measuring distances between objects, or by looking at the colour of pixels around your objects?

    Posting a link to the tutorial you're following would also help.

    Cheers,

    M.
    Please note that my domain has changed to http://www.morganmultinational.com

  3. #3
    Senior Member Zoranan's Avatar
    Join Date
    May 2008
    Posts
    126

    To be honest...

    I don't really know what I'm trying to do. I haven't accomplished anything except putting the terrain and a character on the stage, so posting the file would be a waste. I have tried to detect the color the resides in certain locations before, but I never knew where to start

    If you could tell me how to detect what color different pixels are on, that would be great

    hope to hear back from you...

    Zoranan

  4. #4
    Senior Member
    Join Date
    Dec 2006
    Posts
    274
    I have no first hand experience about the subject but try googling something like:
    as3 OR actionscript3 OR "actionscript 3" pixel perfect collisions

    http://www.kirupa.com/forum/showthread.php?t=293326
    http://labs.boulevart.be/index.php/2...ection-in-as3/

    http://www.emanueleferonato.com/2007...others-part-2/

    Other is to use vector based collision detection,.. I think flash HitTest works that way and mayby Box2d lib also..

  5. #5
    Senior Member Zoranan's Avatar
    Join Date
    May 2008
    Posts
    126
    I wanted to use vector and "hitTest" to do it from the beginning

    Zoranan

  6. #6
    Senior Member Zoranan's Avatar
    Join Date
    May 2008
    Posts
    126
    My code is

    trace (element ("ground").hitTest(mouseX, mouseY, true));


    When I use this code, 3dfa says...
    Method 'hitTest ( )' was given 3 parameters when 1 was expected in 'hitTest' on line 1 trace (element ("ground").hitTest (mouseX, mouseY, true))
    null


    This has never worked for me. Why doesn't 3dfa support this?

    Zoranan

  7. #7
    3DFA hobby scripter LewxX²'s Avatar
    Join Date
    Jul 2006
    Location
    Germany, Karlsruhe
    Posts
    198
    hit test checks if one element hits another element
    sorry for my bad school English
    btw. visit my Page: projects.lewxx.de
    or lewxx.de (<= German)

  8. #8
    Senior Member Zoranan's Avatar
    Join Date
    May 2008
    Posts
    126
    you should be able to use it to check collision with the true shape of elements, instead of the bounding boxes. How do I accomplish this in 3DFA

    Zoranan

  9. #9
    Senior Member
    Join Date
    Dec 2006
    Posts
    274
    I was wrong about hitTest()... in 3dfa it just uses hitTestObject() so it is just bounding box test... in other hand, hitTest(mouseX, mouseY, true) wont work inside 3dfa but should work when exported, but then it only uses one point check...
    So it depends what is your collision testing needs, 3dfa also offers "box" to "lines" test (see collision demo), but if box is not enough then you must use some external collision "libs"... not 3dfa fault but as3 just do not offer ready made complex collision methods.

    This looks interesting.. http://www.tink.ws/blog/as-30-hittest/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center