[SOLVED] How do I calculate bounce angle in isometric view.

Get help using Construct 2

Post » Mon Nov 21, 2016 8:46 pm

@alextro Yeah i got that far, but my main problem was calculating the normal vector between two angles (in and out). It's too bad you can't access the collision box angles, directly with events. That would help a lot.
Follow my progress on Twitter
or in this thread Archer Devlog
B
42
S
18
G
19
Posts: 1,060
Reputation: 14,054

Post » Mon Nov 21, 2016 9:19 pm

@R0j0hound
Everything worked perfectly except a small thing.
angle(0,0,cos(Trace.NormalAngle), sin(Trace.NormalAngle)*2) was supposed to have /2 instead and all worked like a charm.

Thanks a bunch!
Follow my progress on Twitter
or in this thread Archer Devlog
B
42
S
18
G
19
Posts: 1,060
Reputation: 14,054

Post » Mon Nov 21, 2016 9:26 pm

That good it worked. The surface angle in my formula is 90 degrees from the normal angle so that explains why you needed that tweak.
B
94
S
33
G
118
Posts: 5,395
Reputation: 75,851

Post » Mon Nov 21, 2016 10:04 pm

@R0j0hound

There seem to be something wrong. Any idea what it can be? very wide angles tend to be wrong.

Image
Follow my progress on Twitter
or in this thread Archer Devlog
B
42
S
18
G
19
Posts: 1,060
Reputation: 14,054

Post » Mon Nov 21, 2016 10:31 pm

Never mind r0j0 i added you formula directly to the normal instead of the surface angle which messed things up.
Follow my progress on Twitter
or in this thread Archer Devlog
B
42
S
18
G
19
Posts: 1,060
Reputation: 14,054

Post » Tue Nov 22, 2016 12:59 am

@R0j0hound quick question.

set ang_surface to angle(0,0,cos(ang_surface), sin(ang_surface)*2)

if this converts to the non isometric angle. ie 26,5 to 45.

How do i convert something back, from normal angles, 45 to 26,5? i have to reverse this somehow?
Follow my progress on Twitter
or in this thread Archer Devlog
B
42
S
18
G
19
Posts: 1,060
Reputation: 14,054

Post » Tue Nov 22, 2016 1:07 am

Just halve to y component to do it:
angle(0,0,cos(ang_surface), sin(ang_surface)/2)
B
94
S
33
G
118
Posts: 5,395
Reputation: 75,851

Post » Tue Nov 22, 2016 1:54 am

@Thanks R0j0hound.

I'm still getting some weird behaviour with this solution. It seems like i get like this (and like the image above) no matter what I do. All the wide angles seem off and I'm not getting an exit angle at the same angle if they are perpendicular to the surface angle.

Image

Any idea of what i need to adjust? The problem seems to be with the exit angle.
2*ang_surface-ang_in seems to be the problem. Needs adjusting back to isometric?
Follow my progress on Twitter
or in this thread Archer Devlog
B
42
S
18
G
19
Posts: 1,060
Reputation: 14,054

Post » Tue Nov 22, 2016 5:19 am

Here's my current test for the adjusting of the normal for bouncing:
https://dl.dropboxusercontent.com/u/542 ... oTest.capx

You can drag everything around, and the red line is the visual normal and the blue line is the the corrected normal.

The issue as you describe is when the angle the balls travel are perpendicular to the blue normal. Which would mean it's there is no perpendicular motion to reflect so it doesn't bounce.

Mid typing this I re-uploaded the file with an idea that seems to work. It takes both the surface angle and the angle of the ball and doubles the y component before calculating the bounce. Then it halves the y component of the resulting angle.

So if you end up using the normal from the ray caster plugin just add or subtract 90 (it doesn't affect the math) from that the get the surface angle.
B
94
S
33
G
118
Posts: 5,395
Reputation: 75,851

Post » Tue Nov 22, 2016 10:02 am

R0J0hound wrote:Here's my current test for the adjusting of the normal for bouncing:
Mid typing this I re-uploaded the file with an idea that seems to work. It takes both the surface angle and the angle of the ball and doubles the y component before calculating the bounce. Then it halves the y component of the resulting angle.


Seemed like that was the issue. Took a look at your example file and now the angles makes sense. Thanks for a lot for your help!
Follow my progress on Twitter
or in this thread Archer Devlog
B
42
S
18
G
19
Posts: 1,060
Reputation: 14,054

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 11 guests