R0J0hound's Recent Forum Activity

  • Update:

    I touched up the "copy from canvas" action so the texture should never be flipped. It's not completely polished but it should be useable.

    Note:

    For me on chrome it grabs the image from 4 frames ago. I don't know if that can be changed.

    Also as for now the bug where the opacity of a pasted object is ignored if the object has an effect, is still not fixed.

  • Nitro187

    You're right there is no angular damping at all so the object would accelerate indefinitely. It can be useful though so I may eventually make damping built in.

    The way to disable collisions between object's is to use collision groups and layers. They aren't colliding because they both are in the same collision group.

    Actually box2d doesn't work with concave objects either, both libraries need the concave polygons to be converted to multiple convex ones. The built-in physics behavior does this automatically for you, but this behavior doesn't yet.

    mattb

    -1 has a useful meaning for uids that means no object. Instead would being able to type "world" be better? It would make it more clear what was intended.

  • neverk

    You can do it with a loop by pasting a line at a time. It's fast enough to make the image but not necessarily enough to do every frame.

  • Nitro187

    "Set torque" does what it says, it set's the torque. The only difference to apply torque is possibly adding to the torque, but you can do this with "Sprite.chipmunk.torque + something".

    Here's it working with chipmunk

  • Android-Music

    The capx in this post may help.

    Otherwise here's the math to scale any object around a point (centerx, centery). Just do it for all the objects you want to scale around that point.

    set x to (self.x-centerx)*scale + centerx

    set y to (self.y-centery)*scale + centery

    Set width to self.width*scale

    Set height to self.height*scale

  • alextro carl

    Here's an updated capx with more of C2's niceties.

    /examples26/astar_nodes.capx

    https://www.dropbox.com/s/p1w0y1qusjp38 ... .capx?dl=1

  • Updated to version 1.3

    * Fix: removed an alert left in the set mass action.

    * Fix: speed expression was broken.

    mattb

    I'll have to give this more thought to keep things simple. Ideally we could coose from:

    layout x,y

    imagepoint

    relative to orientation of the object *(what's currently done)

    boybacteria

    Thanks for the icon. It makes it look like a physics behavior as much as the name does.

    edit: opps, forgot to add it. will next update for sure.

    spongehammer

    That's a typo on my part. I used ^ which in js means xor instead of squared.

    Prominent

    The built in physics' mass property is more like density, since the box2d mass is calculated with the area of the shape.

    You can do the same in this behavior by setting the mass to with the area expression.

    mattb

    Here's a capx that sets the mass based on object size.

  • Somebody

    "is in crop" may be something that needs to be handled differently. If I ever get it to work right I may check what the scaling mode is an do something different for each.

    Also I need to revisit that transparency bug, but the current , albeit poor workaround is to paste the paster to another paster and set the transparency of that. As I recall that's what I may end up doing internally.

    TiAm Somebody

    I'm not having much progress with getting the canvas pasting to work reliably. It's currently kind of random if it works or not, so I may end up having to go a slower route of making an off screen texture and rendering everything to that.

    neverk

    Perspective transforms aren't possible with the "draw textured quad" action. For that the points would need a z coordinate, but that's not part of C2's renderer. For perspective transforms a shader should be used. The closest we have is the mode7 shader but a better on could probably be made.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • QuaziGNRLnose

    Here's my current solution. It creates a simple webgl program that draws a white rectangle below a black one on a 1x2 canvas. It then reads the pixels and checks if the top pixel is black or not. With that it can know if the texture is flipped or not. This should only need to be run once.

    function isFlippedTexture()
    {
    	var canvas = document.createElement('canvas');
    	canvas.width = 1;
    	canvas.height = 2;
    	var gl = canvas.getContext("experimental-webgl");
    	gl.clearColor(1, 1, 1, 1);
    	gl.clear(gl.COLOR_BUFFER_BIT);
    
    	var prog = gl.createProgram();
    		
    	var vss = gl.createShader(gl.VERTEX_SHADER);
    	gl.shaderSource(vss, "attribute vec3 pos;void main() {gl_Position = vec4(pos, 1.0);}");
    	gl.compileShader(vss);
    	gl.attachShader(prog, vss);
    	
    	var fss = gl.createShader(gl.FRAGMENT_SHADER);
    	gl.shaderSource(fss, "void main() {gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);}");
    	gl.compileShader(fss);
    	gl.attachShader(prog, fss);
    	
    	gl.linkProgram(prog);
    	gl.useProgram(prog);
    
    	gl.bindBuffer(gl.ARRAY_BUFFER, gl.createBuffer());
    	gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([-1, -1, 0, 1, -1, 0, -1, 0, 0,	1, 0, 0]), gl.STATIC_DRAW);
    	var attr = gl.getAttribLocation(prog, "pos");
    	gl.enableVertexAttribArray(attr);
    	gl.vertexAttribPointer(attr, 3, gl.FLOAT, false, 0, 0);
    	
    	gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
    	
    	var tex_small = gl.createTexture();
    	gl.bindTexture(gl.TEXTURE_2D, tex_small);
    	gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, gl.canvas);
    	gl.bindTexture(gl.TEXTURE_2D, null);
    	
    	var fbo = gl.createFramebuffer();
    	gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
    	gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, tex_small, 0);
    	
    	var pixels = new Uint8Array(1 * 2 * 4);
    	gl.readPixels( 0, 0, 1, 2, gl.RGBA, gl.UNSIGNED_BYTE, pixels);
    	gl.bindFramebuffer(gl.FRAMEBUFFER, null);
    	gl.deleteTexture(tex_small);
    	
    	return pixels[0] == 0;
    }[/code:1t7nmz4j]
  • Prominent

    It's not as trivial to add support for as most of the other features added so far, but that's not really stopping it. It just may require a bit more time to do once I start implenting it.

  • TiAm

    I didn't update the download yet so the change in only in my export. So when you try the link and it shows a pixelated image it's no longer flipped for you? If so, then I think I found a fix for that part. Now I just need to figure out why it's not working at all at times.

    Anyways thanks for the testing. Hopefully I can fix the second issue over the next few days.

  • TiAm

    Try this:

    http://tinyurl.com/neye756

    tap to paste the canvas.

    Does it flip?

R0J0hound's avatar

R0J0hound

Member since 15 Jun, 2009

Twitter
R0J0hound has 157 followers

Connect with R0J0hound