Palourde's Recent Forum Activity

  • You used the wrong action in your screenshot, you have to use the "Set Solid collision filter" action, which is in the "Misc" category in the action list instead of the "Solid" category ;).

  • Hello,

    Im trying to create a damage system based on the strengt of the collisions between physics objects. One of my major problem is that whenever I want to know the velocity of an object that is colliding, I cannot get the right value.

    Here is a simplified exemple of my problem :

    When I use :

    On collision between objects A and B => Set "CollisionVariable" to ObjectA.Physics.VelocityX

    The retrieved value is the VelocityX AFTER the collision, but I want the velocity just BEFORE.

    Any Idea of how to do that ?

  • Try to use the "Set Solid collision filter" action.

    For each different sprite object, you can see a "Tag" property in his properties bar, just under the "Solid" checkbox.

    Lets assume that your water is a sprite with the "solid" box checked. You can write "water" in the "Tag" property.

    If the sprite A needs to collide with your water sprite but not the sprite B, then you have to check the "solid" box for the two sprites. Be sure to use the action "Set Solid collision filter" at the start of the layout on sprite B. You have to choose the option "Exclusive" and write "water" (with the "") in the textbox "Tags".

    You sprite B will ignore all solids with the tag "water".

  • Hello,

    For each sprite you can unchek the box "Enable collisions" in the objects properties. This will prevent all collisions to be tested on this object, so all your conditions and actions based on a collision/overlap involving this object will also be ignored.

    Checking/Uncheking the box in the objects properties will only affect the initial collision state of this objects when the layout starts. You can Enable/Disable this at any time during your game by using the action "Enable collisions" in the objects action list.

  • It was THAT easy ! thanks a lot.

    I tested everything but I forget to check the "bullet" box, lol. Its working perfectly now.

  • After a few more tests I found that the collision trigger is not the source of the problem. This is the contact point that is not "triggering".

    You can test it in this capx : 1drv.ms/u/s!AkLLauK5GG7Cg8krl0rDeu3d-cuI6A

    You control the big green thing (this is basically the file I use for the players hitbox in my project. I swear that this is NOT what it looks like ^^'). You control it with the keybords arrows, via physics forces and torques.

    The smaller green object is basically an enemy's hitbox and the black rectangle is an imovable object.

    If you jut go foward and collides with the "enemy", you will notice that the texts object at the top left corner will show the collisions and the number of contact points. You should also noitce that sometimes (like 10%), the ContactCount will not change, despite the collision effectively happens.

    The easiest way to experiment this is to "push" the enemy to the black imovable object and than go for a number of collisions with it by just going backward=>foreward. You should sometime see the contact counter stay the same despite the collision counter go up.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It seems that the condition "Object1 => On collision with Object2" is not triggered every time when the two objects have the Physics behavior. This is especialy true when the objects are colliding on a "flat" surface from their respective hitboxes.

    The collision is clearly visible on screen and everything looks ok with the physics, but "On collision" is not triggerded.

    After a few tests, it appears that the contact points (with expression "Physics.ContactCount") are allways correct, but "On collision" is sometime not triggerded even if ContactCount > 1.

    In my tests, no other conditions than "On collision" where involved and there is only two Physics Object (two different Sprites, not the same instace).

    Am I missing something when I check the collision between Physics Objects ?

  • Nice ! Thank you !

  • Hello,

    I want to get the overall speed of a Physic Object in order to apply a damage value based on the collision strenght between 2 Physic Objects. The only available expressions are Velocity.X and Velocity.Y.

    I first try to use something like (abs(Object.Velocity.X)+abs(Object.Velocity.Y))/2. I thought that if a perfect horizontal movement with velocityX = 100 and velocityY = 0 would leed to VelX = 50 and VelY = 50 for a perfect diagonal move at 330°.

    Instead, the values are more like VelX=70 and VelY=70.

    I wonder what how to retrieve the real overall speed value in any direction ?

  • I achieved to get the ratio between the rotation speed and the impulse strength with unlerp(0 ,90, anglediff(angle(B.x, B.Y, A.X, A.Y))) . This gives me the multiplyer to apply to the rotation speed. Then, "1-unlerp(...)" give me the multiplyer for the impulse speed.

    As said by dop2000, its not 100% accurate, but its hard to notice the difference between ths and a "real" physical hit.

  • Thank you guys, its working perfectly !

    I however had to add a couple of conditions to test if the bullet hits either the "front" or the "rear" of B (which looks more or less like a ship). Otherwise, the rotation direction was only correct when I hit the rear. The rotation is now applying correctly everywhere on the object.

    I ill now try to find the good ratio between the impulse strenght and the rotation speed depending on the angle of the bullet, but this should be easier.

    Thank you for your help !

  • Thank you very much for these annwsers !

    R0J0hound, your method looks amazing but my math level seems way too low and my brain melted somewhere in the process :(

    I'm trying to use a combination between El Constructor's and dop2000's methods. The "realisticness" of the result is not that mandatory for the gameplay, so this should do the job.

    First of all, Im trying to apply dop2000's method in order to retrieve the rotation direction. But I dont understand this point : "Let's say this difference is 20 degrees, so you apply an angular velocity in the opposite direction, -40 for example. "

    I use anglediff(angle(B.x, B.y, A.x, A.y), B.Angle), this will always gives me a result between 0 and 360. But angular velocity is either a positive or negative value(for clockwise or anticlockwise). Im probably a little stupid here, but I dont understand how a can apply an angluar velocity in the opposite direction of a number thats always positive (0 -> 360).

Palourde's avatar

Palourde

Member since 14 Sep, 2016

Twitter
Palourde has 1 followers

Trophy Case

  • 8-Year Club
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

11/44
How to earn trophies