Results 1 to 6 of 6

Thread: CL_CollisionOutline - saving in file and loading

  1. #1

    Default CL_CollisionOutline - saving in file and loading

    Recently I stumbled across the save function of CL_CollisionOutline so I went ahead and saved the collision oultines of my big boss graphics in files.
    But after the first positive result (yay no loading times at all!) I recognized my collision detection is working horribly wrong now Oo

    I used the following code to save 2 boss.pngs :
    Code:
    outline = new CL_CollisionOutline ("data/src/level1/boss1.png", accuracy_high);
    	outline->save("boss1_1.out");
    	outline = new CL_CollisionOutline("data/src/level1/boss2.png", accuracy_high);
    	outline->save("boss1_2.out");
    And the following code to load it again :
    Code:
    outline = new CL_CollisionOutline ("boss1_1.out");
    Before, I just created it on runtime with:
    Code:
    outline = new CL_CollisionOutline("data/src/level1/boss1.png", accuracy_high);
    Not that it isn't working at all but it looks like the outline isnt moving with the picture synchronized anymore, or maybe its just smaller or whatever?
    Any clues? Thanks in advance!
    Last edited by Unfixab1e; 05-21-2010 at 11:43 PM.

  2. #2

    Default

    Maybe I should specify my question:
    Which differences are there between:
    Code:
    outline = new CL_CollisionOutline ("data/src/level1/boss1.png", accuracy_high);
    outline->save("boss1_1.out");
    outline = new CL_CollisionOutline ("boss1_1.out");
    and

    Code:
    outline = new CL_CollisionOutline("data/src/level1/boss1.png", accuracy_high);

  3. #3
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    I have never used the collision outlines before.

    Have a look at the source. It is possible that you have found a bug.

  4. #4
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    I have added a todo at: http://clanlib.org/wiki/TODO

    * Check CL_Collision functions. The Tests/Display/Collision example accuracy breaks at certain positions (giving incorrect collisions). Also check the collision outline load and save works. Ideally create an example with a GUI controlling the options (like Display/Blend etc).

  5. #5
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    I could not find anything wrong with the collisions.

    I have modified the ClanLib 2.2 SVN "Tests/Display/Collision" test, to show "save and load"

    I did fall into a trap though.

    The positions, translations are not saved with the collision outline (which is correct)

    Now, CL_CollisionOutline::set_alignment(), set_rotation(), set_translation() modifies the collision outline.

    If you save the outline after using these functions, the collision outline will be offset.
    So future calls to set_translation() will not be able to "undo" the previous translation before applying the new one.

  6. #6

    Default

    I also have never used the collision outlines before.
    May be there is a bug in the source.

Similar Threads

  1. Beginners Question regarding CL_CollisionOutline & collide
    By Unfixab1e in forum Official ClanLib SDK Forums
    Replies: 5
    Last Post: 12-21-2009, 09:47 AM
  2. Patch : load method for CL_CollisionOutline
    By sandelz in forum Official ClanLib SDK Forums
    Replies: 2
    Last Post: 05-27-2009, 06:35 PM
  3. Question about CL_CollisionOutline
    By n-palmer in forum Official ClanLib SDK Forums
    Replies: 5
    Last Post: 09-20-2006, 02:38 PM
  4. pillbugs and saving
    By in forum Dink Smallwood HD
    Replies: 2
    Last Post: 05-01-2005, 10:51 PM
  5. saving game
    By lowec in forum Dink Smallwood HD
    Replies: 1
    Last Post: 01-09-2005, 12:25 PM

Bookmarks

Bookmarks

Posting Permissions

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