How do I apply impulse but as an absolute position

0 favourites
  • 13 posts
  • Hi,

    I have a problem to add an impulse that do the same result independent of the object rotation.

    What I mean is that I want to apply impulse always in the black arrow direction

    If I understand correctly, it seems that the direction is relative to the object rotation.

    Maybe I'm missing something?

    Thanks !

  • Thanks for your example, but I don't think that is my problem.

    I found that the impulse work correctly except when I change the position of the object to the same position of my trigger.

    Here an example of what I mean.

    https://www.dropbox.com/s/c21mi1054g97e ... .capx?dl=0

  • My example was correct. It is you who does not understand.

    Your ball cant act as a ball, it has square colission polygones.

    You move an object middle in an object and then 'on collision' with that object you want to do something. I have now idea how this can result in something 'physical'. Other then generating 'black hole forces'.

    You dont move it with physics (That would be ofcourse inpossible) In reality, in a world ruled by physics, when i magicaly and instantly move a tennis ball middle into you brain, what would happen ?

  • Your example was correct it was just not what I was looking for.

    For the square collision, it was only a example I done quickly. You are right, I keep forgetting that you cannot use set position with physics object, it always do something strange. Thanks for reminding me that.

    I can work around with spawning my object instead of moving it.

  • You still cant spawn it middle in that object and have that condition that goes for collissions with that object. Spawning will not solve that. I dont know what you want to do with it, makes not sense to me. This is why i can only say something negative. Something positive, as in solving your problem, i cant. I dont like that myself, sorry.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can Creative another sprite with invisibility, use pin position only and push this sprite

  • You still cant spawn it middle in that object and have that condition that goes for collissions with that object. Spawning will not solve that. I dont know what you want to do with it, makes not sense to me. This is why i can only say something negative. Something positive, as in solving your problem, i cant. I dont like that myself, sorry.

    My goals is that when a box enter the wrong tube, it is throw back from a central tube.

    Man if you could just try to understand without being so negative. If you would have look correctly to my example you could see that spawning the object inside the trigger work great.

    Please before saying something like you know everything just be sure that you are not wrong.

  • dondosh

    When you left-click and move Sprite3 over the blue box, the object collides with the box for several ticks, so the impulse is applied multiple times - and that makes it fly off so fast you can't see it move.

    so, you need to find a way to apply the impulse only once - by moving the object just above the box (so it will fall on it like the way the right-clicked ones do), or use an instance variable that gets set when the impulse is applied that prevents it from happening again.

    Also, the angle of impulse you are using (150) is down to the left (180 would be straight to the left). Your picture shows you want an upward impulse, so I was using 255 degrees and an impulse of 4 to get something close to what you are after. I also set the velocity to 0,0 just before applying the impulse and that gave more consistent results.

  • He will not have the same problem (that problem he creates on that right click) when coding that example in that picture. See that 'enter here' ? The ball will aproach from the outside of the trigger, not from the inside .... and then collide at a miljoen times/tick. So its all ok, and guess its solved by a new game logic.

  • My example was correct. It is you who does not understand.

    Your ball cant act as a ball, it has square colission polygones.

    You move an object middle in an object and then 'on collision' with that object you want to do something. I have now idea how this can result in something 'physical'. Other then generating 'black hole forces'.

    You dont move it with physics (That would be ofcourse inpossible) In reality, in a world ruled by physics, when i magicaly and instantly move a tennis ball middle into you brain, what would happen ?

    Dude he didn't say your example is not correct, he said he was looking for something different. Also being a smart a$$ isn't a good way to make friends. Treat people with respect!!

  • Please keep all posts on topic and responses polite.

    It is easy for both native and non-native English speakers to misinterpret a response so always try to see both sides.

  • it's fixed by spawning instead of moving the object

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)