Getting a bullet object's angle of reflection

Get help using Construct 2

Post » Wed Oct 09, 2013 1:20 am

Is there a way to get the angle of reflection value from an object with the bullet behavior when it collides with another object?

I was using the bullet bounce-off-solids behavior for an object, but I would like to pause and play a short animation when the object collides with a wall before it bounces off (it's a little grip-the-wall-and-then-launch-off animation).

I tried turning off the bounce off solids and using the bounce action after playing my animation, but it sends the object in an unexpected direction (instead of reflecting off the surface, it bounces back along the vector that it entered), perhaps because it no longer has the original vector?

I was hoping to get the angle of reflection on the initial collision with the object, save that, then set the sprite's angle of motion to that value when the intermediary animation is finished.

Can I get this value? Other suggestions for how to do this?

Here's a quick isolated test case that's fairly representative of the issue (press mouse buttons to rotate the thing).
http://storage.wertle.com/construct2/AngleProblems.capx
B
11
S
2
Posts: 87
Reputation: 1,112

Post » Wed Oct 09, 2013 8:42 am

Set bounce of solid to yes and try this:

I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Oct 09, 2013 4:52 pm

Works like a charm, thank you!
B
11
S
2
Posts: 87
Reputation: 1,112


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 15 guests