R0J0hound's Forum Posts

  • Slide joints should be like pin joints, but you specify a minimum and maximum distance instead of using the distance between anchor points.

  • icepam

    I added an improved "draw quad" action that can set the texture uv's of an image. Attached is an example. It uses and updated paster plugin so you'll need to re-download it.

    Notice it still doesn't look right since without z it's an affine transformation. For a correct look the z would need to be calculated for each point and the perspective drawing would have to be done manually.

  • Cursors

    In event 4 of the capx I posted. In the capx I use -1, and in the quote I'm suggesting to use -2.

  • icepam

    That's not really possible using this plugin.

    You could of course calculate the transformation matrix from the points on the left to the points on the right, and apply the same transformation on the corners of the image on the left. It's a rough idea and a little tedious to do, especially if you've never done any matrix math. I could also instead possibly add another "draw textured quad" action that let's you specify uv coordinates to use.

    The second and probably more pressing problem is the "draw texture quad" action doesn't do any perspective correction since it has no z knowledge. It looks like "affine" in this link:

    http://en.wikipedia.org/wiki/Texture_ma ... orrectness

    So you'd either have to write an effect to do the perspective drawing or do it with math in events a pixel at a time, which is relatively very slow. The math is basically in the above link but it doesn't cover everything.

    I was able to use it a few posts back with horizontal lines but it's not enough for what you're after.

    plugin-paster_p875157?#p875157

  • Update 2.2a

    Download in first post.

    Fix: JointAnchor expressions were not giving the correct positions right away if objects were moved.

  • Interesting idea, but it is much more limiting than events and most of the behaviors would be ambiguous what they would do imo. The main tricky bit is it becomes harder to reference values you set in some levels of your node tree, since the tree is run in a way depending on what's connected. Events are simpler in that respect since they are run top down.

    That said it could be an interesting tool to make complex motion equations, but probably not in C2. It would also need some designing to flesh out what nodes you could have and what they'd do. Behaviors for instance wouldn't work so well being put anywhere because they depend on the object itself.

    I do like the concept, so I made a capx to play around with it.

  • Update 2.2

    Download in first post.

    * Fixed: Adding joints in to new objects in "post collide"

    * Fixed: Movement actions for new objects in "post collide" were ignored.

    Prominent

    In "post collide" new objects aren't added to the simulation till right after the physics step. So they won't trigger a "post collide" till at least the next frame.

  • Update 2.1a:

    Download i first post.

    *Fixed: Creating object during "pre step" or "post collide"

    kmsravindra

    It stops moving due to object sleeping.

    You can disable sleeping with the "Global Settings"->"set sleep time threshold" action. A value of Infinity is disabled.

    Document tidbit:

    The way sleeping works is the object will be put into a non-moving "sleep" state if it's idle for a time equal to or longer than the "sleep time threshold". The object is considered "idle" if it's speed is less than the "idle sleep threshold", which by default has a value based on the gravity.

  • Hmm, that's no good. I'm out of time today, so it'll have to wait till tomorrow. In the meantime you can try and comment out line 6714.

  • sir LoLz

    I finally tried those solutions and you can't get the tilemap to draw tiles that are offscreen. Try instead to move the tilemap onscreen, paste it and move it offscreen. That should work.

    I haven't seen the second issue you describe and I can't reproduce it.

    frcol

    "Paste object" will draw the specified in place wherever it overlaps the paster object.

    See the attached example.

  • Finally saw this. Glad you got it working.

  • Updated to 2.1

    Download in first post.

    *Fix: Setting object to immovable after creating a joint in a "pre step" or "post collide" condition. Actually the fix should correct any errors claiming stuff is being added twice.

    *Fix: Setting immovable to No when it was immovable caused and error.

    *Fix: Angle would become nan if both connected bodies of a joint were immovable.

    *Fix: choosing 'Is disabled' condition would give 'For each collision pair' instead.

    *Fix: Error about removing/adding shape that isn't or already is in space.

    keepee

    Thanks, it was a typo on my part. I'm surprised that C2 didn't complain about that one.

    Prominent mattb

    Using the custom movement behavior isn't ideal for that sort of thing. Attached is a way to find the point on the edge of a shape. toggle between events 3 and 4.

    Event 3 uses the contact depth and normal to find the point on the edge, which works for other object's corners, but not the current object's corners. Not much can be done there as it's how the library works.

    Event 4 uses the query from point condition to find the closest point on the edge. This probably won't work the way you want with tilemaps though.

    Contact points are only accessible from under the "post collide" and "for each collision pair" conditions. So yeah you'd need to save the info to variables to use outside of that.

    A segment query from the object's center to the contact point may be one solution.

  • Try Construct 3

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

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

    The cursor object only has the spring joint so only that gets destroyed. The pin joints are connected to the sprite object which isn't connected to the cursor object.

    2

    That event is to demonstrate joint breaking. With the event enabled pull one of the balls down. When you pull far enough the impulse on the joint will get too large and the joint will be destroyed so the ball will break free

  • Prominent

    The contact depth should be the distance from the edge, but I'll look into it. The point query condition will give a negative queryDist when the point is inside a shape.

    mattb

    That appears to be how the chipmunk library works. Those contacts flicker on and off when you look at it continually. I'll probably investigate further.

    I'll try to get those bugs fixed tomorrow. I'm also going to do some internal tweaks to better address future issues and hopefully prevent them.

    Documentation tidbit:

    The collision layers property is a list of 32 layers and whether an object is in one or not. I opted for 8 hexadecimal digits instead of 32 binary to shorten it.

    The default value: ffffffff means the object is in all the layers. Whereas 00000001 means the object is in that one layer.

    If you don't need all 32 layers and don't want to deal with hexadecimal numbers you can use 1 or 0 and have 8 layers.

    The objects can collide if any two digits are both 1. For example:

    Obj1 00000001

    Obj2 11111111

    They can collide.

    Obj1 00000001

    Obj2 11111110

    They won't collide.

    Obj1 11110000

    Obj2 00001111

    Obj3 11111111

    Obj1 won't collide with obj2 but both can collide with obj3

    Another way you can think of it is as a set of rules of what is allowed to collide with what.

    Player collides with wall, enemy and enemy bullets but not player bullets

    Wall collides with everything

    Player bullet collides with enemy and walls

    Enemy bullet collides with player and wall

    Enemy collides with wall, enemy and player bullet.

    Then you assign a layer to each

    Wall, player, enemy, player bullet, enemy bullet

    And with the rules set the layers accordingly:

    Wall 11111

    Player 11101

    Enemy 11110

    Player bullet 10110

    Enemy bullet 11001

    Another idea would be to have a seperate background layer with something moving and you don't want the player colliding with it. So for that the player's collision layer could something like 0001 and the background 0010.

  • Prominent thanks for the report. I'll be looking into it.

    spongehammer

    You can already get the impulse applied to a joint so yes you can make something like that.

    kmsravindra

    #1 Physics libraries are only a approximation, so energy isn't always conserved. You can increase the "global settings"->iterations to make it more accurate. You can also make the fixed timestep smaller to make collisions more accurate as well.

    #2 Toggling immovable isn't the best way to drag objects around. The switch discards any contact points and isn't very physically correct. A better way is to attach a joint to an object that is moved directly. See bottom of post.

    #3 If it causes a js error then it's a bug. I'll look into it.

    spongehammer

    It's correct, elasticity in physics is how a collision reacts, not how rubbery it is. An elasticity of 1 should mean that no energy is lost in a collision, which is pretty much how ball bearings act when they collide.

    Attached is a physics way to drag objects around. When you click on an object you create a joint to a no collision, immovable sprite that is moved around by the mouse. Then when the mouse is released the joint is removed.

    Also the joints in the capx are set to break if you're too rough.