User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11

Thread: Problem with physics shape

  1. #1
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export Module
    Outcast's Avatar
    Join Date
    Jan 2011
    Location
    Sweden
    Posts
    3,237
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)

    Question Problem with physics shape

    I have a bit of a hard time to get my head around how the shaping on physics works. I have an item that is set to have its shape be based on the first frame (it only have one frame though), but the physics shape does not seem to correspond with the actual shape.

    If you spawn an object in the frame and it falls down on its "head" the phsyics shape seems to be bigger than the actual shape of the object. It seems like it is "longer" on the bottom end by the "head".

    How can I solve this and why is it not of the actual shape of the object?
    Attached files Attached files

  2. #2
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCiOS Export ModuleInstall Creator Pro
    Julian82's Avatar
    Join Date
    May 2012
    Location
    outbuddies.com
    Posts
    990
    Mentioned
    50 Post(s)
    Tagged
    0 Thread(s)
    Can't have a look at your .mfa right now but my guess is that the shape of your object ist too complex for an accurate collision. Fusion estimates a polygon shape around physical object`s center of gravity for the collision mask which unfortunately cannot be seen or modified like in other game engines. An important thing that you probably already know is that the hot spot always hast to be set to the center of gravity (G-Button in the hotspot quickset). I'm working with the physics engine for quite some time now and as a rule of thumb for Fusion you have to rely on objects that are rectangles or ellipses to really have accurate collisions. For complex shapes like an "L" for example you would need to chain two rectangles together using a revolute joint with fixed angle. Shapes that cannot be constructed of ellipses and rectangles won't really work with the physics engine.

    In case you want the collision shape to be different from the visible shape of the object you either have to switch from stop to a custom animation or force another frame after frame boot. You can also put the desired collision shape in the "appearing" animation as this animation will be auto-played if available when an object is newly spawned and then defines the physical collison polygon.

  3. #3
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export Module
    Outcast's Avatar
    Join Date
    Jan 2011
    Location
    Sweden
    Posts
    3,237
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Julian82 View Post
    Can't have a look at your .mfa right now but my guess is that the shape of your object ist too complex for an accurate collision. Fusion estimates a polygon shape around physical object`s center of gravity for the collision mask which unfortunately cannot be seen or modified like in other game engines. An important thing that you probably already know is that the hot spot always hast to be set to the center of gravity (G-Button in the hotspot quickset). I'm working with the physics engine for quite some time now and as a rule of thumb for Fusion you have to rely on objects that are rectangles or ellipses to really have accurate collisions. For complex shapes like an "L" for example you would need to chain two rectangles together using a revolute joint with fixed angle. Shapes that cannot be constructed of ellipses and rectangles won't really work with the physics engine.

    In case you want the collision shape to be different from the visible shape of the object you either have to switch from stop to a custom animation or force another frame after frame boot. You can also put the desired collision shape in the "appearing" animation as this animation will be auto-played if available when an object is newly spawned and then defines the physical collison polygon.
    The shape is not really complicated though, I have attached it. The problem is that it seems it thinks it is about 1/4 longer than it actually is for some reason :S

    Leek.png

  4. #4
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCiOS Export ModuleInstall Creator Pro
    Julian82's Avatar
    Join Date
    May 2012
    Location
    outbuddies.com
    Posts
    990
    Mentioned
    50 Post(s)
    Tagged
    0 Thread(s)
    I'll have a look at it today evening! You're right the length should not be the problem (if the Gravity-Center is set right). You'll get some errors on the curved sides tho.

    Cheers

  5. #5
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    Wodjanoi's Avatar
    Join Date
    Jun 2015
    Location
    Germany
    Posts
    665
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    s1.png
    (click to enlarge)
    I also tested Outcast's example with these 4 test shapes - each shape will lead to a different result.

  6. #6
    Clickteam Clickteam
    Fernando's Avatar
    Join Date
    Dec 2006
    Posts
    6,784
    Mentioned
    298 Post(s)
    Tagged
    4 Thread(s)
    mm not sure butthis maybe will help you regarding these shapes

    http://box2d.org/forum/viewtopic.php?t=6025
    Regards,


    Fernando Vivolo

    ... new things are coming ...

  7. #7
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCiOS Export ModuleInstall Creator Pro
    Julian82's Avatar
    Join Date
    May 2012
    Location
    outbuddies.com
    Posts
    990
    Mentioned
    50 Post(s)
    Tagged
    0 Thread(s)
    Had a look at your .mfa and found nothing was set up wrong. The hotspot was not exactly set to the center of mass, but resetting it did not really improve the results. Interesting source from Fernando, only had a quick glimpse at it but it seems to explain why the type of shape you're using may mess the polygon estimation up. Would be really great if we could set the physcial collision shapes manually, very likely not before F3.

  8. #8
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export Module
    Outcast's Avatar
    Join Date
    Jan 2011
    Location
    Sweden
    Posts
    3,237
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    Hmm.. so the only solution would be to experiment with having a frame before the real frame with different sizes?

  9. #9
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCiOS Export ModuleInstall Creator Pro
    Julian82's Avatar
    Join Date
    May 2012
    Location
    outbuddies.com
    Posts
    990
    Mentioned
    50 Post(s)
    Tagged
    0 Thread(s)
    Probably yes. To sum it up Fusion can handle symmetric polygons with only convex surfaces pretty well, like boxes, hexagons, triangles and circles. Everything with concave surface elements like stars and angles (like C or L-shapes) will be messed up tho. I think assymmetric convex-only polygons should work too if the center of mass is set correctly.

  10. #10
    Clickteam Clickteam
    Fernando's Avatar
    Join Date
    Dec 2006
    Posts
    6,784
    Mentioned
    298 Post(s)
    Tagged
    4 Thread(s)
    Probably yes. To sum it up Fusion can handle symmetric polygons with only convex surfaces pretty well, like boxes, hexagons, triangles and circles.
    this is a limitation on the box2d physics code.
    Regards,


    Fernando Vivolo

    ... new things are coming ...

Page 1 of 2 1 2 LastLast

Similar Threads

  1. How can I create Z or L shape physics objects ?
    By TGeorgeMihai in forum Fusion 2.5
    Replies: 1
    Last Post: 9th July 2018, 06:50 PM
  2. Replies: 0
    Last Post: 8th September 2017, 02:27 AM
  3. Physics Collision shape of image update?
    By paobrasil in forum Fusion 2.5
    Replies: 2
    Last Post: 19th September 2015, 11:15 AM
  4. Replies: 0
    Last Post: 6th October 2013, 07:41 AM

Posting Permissions

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