R0J0hound's Forum Posts

  • 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.

  • 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?

  • Colludium

    You need to re-download the plugin. It uses an action I just added.

  • You can paste object's anywhere, including off-screen. The object you're pasting just needs to overlap the paster object.

    The exceptions currently are particles and tilemaps. They need to be onscreen to be able to be pasted.

  • Somebody

    The resolution can be set to anything from 1x1 up to the largest texture size your graphics card supports, whatever that may be. And yes you can do just that. In the example the canvas is copied to the screen object and a portion of that is pasted to the paster object which has a resolution of 32x32. So then if you saved Paster.imageUrl you'd get a 32x32 pixel image.

  • Try Construct 3

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

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

    I appreciate testing it. I'm currently limited to only being able to use webgl in chrome 33 (probably should upgrade). Every other browser either on my laptop either never worked with webgl or somehow now won't work with webgl. I have another pc that I don't have access to atm that I'll test on if I need to.

    I did another tweak to do something that is used elsewhere in the plugins. Does it give better results?