How do I apply impulse but as an absolute position

Get help using Construct 2

Post » Tue Jun 07, 2016 7:45 pm

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

Image

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

Maybe I'm missing something?

Thanks !
B
10
S
5
G
6
Posts: 26
Reputation: 3,940

Post » Tue Jun 07, 2016 8:35 pm

B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Tue Jun 07, 2016 9:01 pm

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
B
10
S
5
G
6
Posts: 26
Reputation: 3,940

Post » Tue Jun 07, 2016 9:46 pm

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 ?
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Wed Jun 08, 2016 12:05 am

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.
B
10
S
5
G
6
Posts: 26
Reputation: 3,940

Post » Wed Jun 08, 2016 8:56 am

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.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Wed Jun 08, 2016 9:59 am

You can Creative another sprite with invisibility, use pin position only and push this sprite
B
22
S
3
Posts: 74
Reputation: 1,515

Post » Wed Jun 08, 2016 3:11 pm

99Instances2Go wrote: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.
Image
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.
B
10
S
5
G
6
Posts: 26
Reputation: 3,940

Post » Wed Jun 08, 2016 4:02 pm

@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.
B
97
S
34
G
20
Posts: 438
Reputation: 17,790

Post » Wed Jun 08, 2016 5:40 pm

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.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Next

Return to How do I....?

Who is online

Users browsing this forum: dop2000 and 42 guests