luke7eco's Forum Posts

  • C3 uses WebGl so regular Html5 Canvas objects, and various effects won't work.

    The Svg object takes the regular elements and converts it to work in the accelerated context.

    You can use the Html Element for those however.

    Thanks

    Do not actually understand how to make it work with HTML Element.

    I'm creating HTML Element with an "svg" tag and such content inside:

    <circle cx="50" cy="50" r="40" fill="red" />

    But in preview, it shows nothing.

    Also, to make that filter work right it is required to create 2 HTML Elements and place all instances of one inside of code of another.

  • any ideas? How to group all SVG instances and add them same style?

    I guess to create an SVG filter I should use something like this:

    	var defs = svg.append("defs");
    	var filter = defs.append("filter").attr("id","SVGFilter");
    	filter.append("feGaussianBlur")
    		.attr("in","SourceGraphic")
    		.attr("stdDeviation","5")
    		.attr("color-interpolation-filters","sRGB") 
    		.attr("result","blur");
    	filter.append("feColorMatrix")
    		.attr("in","blur")
    		.attr("mode","matrix")
    		.attr("values","1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 15 -4")
    		.attr("result","effect");
    

    But I don't know how to use it over SVG instances and where to put it.

  • It should work how you describe, check in debug view if the instances have increased. Maybe they exist but you can't see them for some reason. If there are some SVG created then you can pick them from the inspector and see where they are. If they definitely haven't appeared then please share the project :)

    You're right. It works. Probably did something wrong before.

    Thanks.

  • On start of layout, it creates only instances for Sprite from the container but does not create instances for SVG object that is also there. Can you rephrase?

    "On start of layout" has sub-event "Repeat 100 times", which has an action "Spawn another object".

    In the Manual for containers are such sentences:

    - If one object in a container is created, every other object in its container is also automatically created.

    - If a condition picks one object in a container, every other associated object in its container is also picked.

    When I use the action "Spawn another object" and choose the Sprite object which is in the container it creates only 100 instances for the Sprite (I see it in debug layout).

    As far as I understand from the manual, the system must also create 100 instances for SVG object, because it is in the same container with a Sprite, but it does not happen.

  • I have 2 objects in the container:

    - Sprite (with Physics behavior)

    - SVG (with Pin behavior). In the events sheet, it is pinned to the invisible Sprite (On start of layout), additionally added as a child to that Sprite.

    When I create condition:

    System Repeat XX times and in the actions choose Sprite2, which is not in the container (action Spawn another object choose a Sprite which is in the container)

    On start of layout, it creates only instances for Sprite from the container but does not create instances for SVG object that is also there.

    Do I do something wrong?

    Tagged:

  • Hi

    I have an SVG file with a filled circle (<circle></circle>) inside.

    I'm using the SVG plugin and:

    - add to wrap container SVG object and invisible Sprite

    - Pin such SVG object to that Sprite

    - also add SVG object as a child to that Sprite

    Does somebody know how to pick all SVG instances and add an SVG filter to them?

    Adding filters inside an SVG file with a circle does not give that effect. They probably must be the inside of the same class. Here is required solution to add filters to the full layer with such instances.

    Filters I want to add feGaussianBlur, and feColorMatrix.

    Thanks

    Tagged:

  • I guess in conditions I should choose "Is boolean instance variable set" (InBox) and Invert it (so it will be "false"). This will allow me to pick instances with a specific instance variable.

    In action, I should "Add script" with something like this (because I still need to have enabled collisions with that object (Family) for instances with instance variable InBox=true):

    for (const inst of runtime.objects.Ball.pickedInstances())
    {
    	// here must be a code to disable collision with a specific Physics object (Family in my case)
    }
    

    Ashley I will be grateful for a code snippet that will allow me to disable collision with object Family for picked instances

  • Anyway, thank you.

    I think this will work similarly to "Is boolean instance variable set"

    But my problem is more on the Action level, where I can't find options that will allow me to disable collisions for the instance variables. There is the only option to choose an object.

  • Did you try using a for each ball and then if on the InBox variable?

    Just an idea. You can print out line by line in the for each loop to

    get a better handle of what is going on.

    I'm a beginner in this stuff and have no experience in programming.

    Do you mean I need to use scripting: instVars and getAllInstances(), addEventListener(type, func, capture)?

    Can I get an example of your idea? Thank you.

  • Hi

    I have a box (without cover) and balls inside (with Physics behavior). Balls have boolean instance variable: InBox = true

    I added an invisible sprite on the top of the box. When I rotate a box, balls fall out (on collision with sprite change boolean from true to false).

    Problem:

    I need to disable collisions of Instances (that have instance variable InBox=false) with object family.

    I tried to do it using the Invert InBox condition and action: Disable Physics collision with Family, but it disables all collisions (not only for instances with InBox=false).

    How to disable collisions only for instances with specific instance variables?

    Thank you for any help.

  • Hi Colludium

    Let me know how I can get your latest LFJS addon because your itch is unavailable.

    I need this addon or someone's recommendations on how to import WASM (WebAssembly) Liquidfun v7.0.0 (Github) to Construct 3 and how to create particles and kinematic bodies using this JS.

    Thanks

  • Here's one idea:

    Attach the bowl to an immovable physics object with a revolute joint.

    Then change the angular velocity to turn toward the angle you want.

    Details with some more explanations:

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

    In general think of setting angle or position of physics objects as the same thing as teleporting. In your example you set the angle directly so if you rotated the bowl object fast enough the balls could suddenly be on the other side of the walls of the bowl. The physics engine won't think the balls went though the walls.

    However when setting velocities the physics engine can do it's magic to avoid jumping through walls. Especially if the "bullet" setting is enabled which does continuous collision detection.

    Thank you so much for your explanation and example.

    Changed collision polygon for Ball in your example, spawn 100 balls and on fast speed slider dragging (right-left) some balls can pass through the walls or stuck inside despite only Physics behavior.

    If I enable Bullet setting for the ball or bowl (continuous collision detection), mass of balls pushes the bowl down (bowl flies down). How to prevent it?

  • For physics to work best you'll want the motion of objects to only be handled by the physics behavior. Any other behavior will interfere. Also at no time use set position or angle. You can set angular/linear velocities, apply forces or impulses to move things.

    For something like a rotating box you'll need to do that with joints to put it together. Then with the "bullet" setting the balls will bounce off walls no matter how thin.

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

    Of course you still can overpower the joints at times, but usually it's stable.

    Thank you for your example.

    I use a slider to change the angle of the box (with a limitation of movement between 0 and -120 degrees). Also, my box is a full-piece sprite. Balls have small collisions (as mentioned before).

    My brain is blowing up how to do it only using Physics behavior.

    GIF Image

  • Only use the physics behavior, and there’s a continuous collision detection check mark I think.

    Physics doesn’t work with other behaviors.

    This would probably work if the balls had the size of the collisions as the width of the Sprite. But for my purposes collision polygon of the ball is smaller than Sprites width and height.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Only use the physics behavior, and there’s a continuous collision detection check mark I think.

    Physics doesn’t work with other behaviors.

    I've already tried to use only Physics behavior for box and balls but it does not work. When I change the angle of the box, balls pass through the box walls (despite collisions and Immovable mark).

    Adding 8Direction behavior to the ball and Solid to the box allows keeping balls inside of the box when I slowly change the angle. But if I change the angle fast, balls still pass through the box walls.