ulfben icon

nape.as, Physics Editor export template

ulfben | PRO | 02/17/16 04:15:20 PM UTC | 0 ⭐ | 11045 👁️ | Never ⏰ | []
ActionScript 3 |

0 B

|

None

|

0 👍

/

0 👎

//from nape.as, the Physics Editor (https://www.codeandweb.com/physicseditor) Nape-exporter template.
//nape.as is located in [install directory]\CodeAndWeb\PhysicsEditor\resources\exporters\nape-as3\
//Changes:
    //fixed typos: "{{body.cbType}}" => "{{body.cbTypes}}", "{{fixture.cbType}}" => "{{fixture.cbTypes}}"
    //added comment with body name at start of definition to help when navigating the source
    //changed s.body = body; => body.shapes.add(s) for my own peace of mind (clarify intention)
 
private static function init():void {
        bodies = new Dictionary();
 
        var body:Body;
        var mat:Material;
        var filt:InteractionFilter;
        var prop:FluidProperties;
        var cbType:CbType;
        var s:Shape;
        var anchor:Vec2;
 
        {% for body in bodies %}
            //{{body.name}}
            body = new Body();
            cbtype(body.cbTypes,"{{body.cbTypes}}");
            {% for fixture in body.fixtures %}
                mat = material("{{fixture.material}}");
                filt = filter("{{fixture.filter}}");
                prop = fprop("{{fixture.fprop}}");
                {% if fixture.isCircle %}
                    s = new Circle(
                        {{fixture.radius}},
                        Vec2.weak({{fixture.center.x}},{{fixture.center.y}}),
                        mat,
                        filt
                    );
                    body.shapes.add(s);
                    s.sensorEnabled = {{fixture.sensorEnabled}};
                    s.fluidEnabled = {{fixture.fluidEnabled}};
                    s.fluidProperties = prop;
                    cbtype(s.cbTypes,"{{fixture.cbTypes}}");
                {% else %}
                    {% for polygon in fixture.polygons %}
                    s = new Polygon(
                        [ {% for point in polygon %} {% if not forloop.first %}, {% endif %} Vec2.weak({{point.x}},{{point.y}})  {% endfor %} ],
                        mat,
                        filt
                    );
                    body.shapes.add(s);
                    s.sensorEnabled = {{fixture.sensorEnabled}};
                    s.fluidEnabled = {{fixture.fluidEnabled}};
                    s.fluidProperties = prop;
                    cbtype(s.cbTypes,"{{fixture.cbTypes}}");
                    {% endfor %}
                {% endif %}
            {% endfor %}
            anchor = ({{body.auto_anchor}}) ? body.localCOM.copy() : Vec2.get({{body.anchorPointAbs.x}},{{body.anchorPointAbs.y}});
            body.translateShapes(Vec2.weak(-anchor.x,-anchor.y));
            body.position.setxy(0,0);
            bodies["{{body.name}}"] = new BodyPair(body,anchor);
        {% endfor %}
    }

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  • Rteuixl icon
    04/02/26 04:33:59 PM UTC
    text |

    0 B

    |

    0 👍

    /

    0 👎

    Best t33n active cpx link daily updates!
     Copy and paste the link in a new browser tab and then hit enter!
     https://crazyporn.@xxx/members/157354/?asgtbndr=1&play=true&spon=adworld&zone=400
     Remove the @ 
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎