Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skater can bounce back up an incline when originally on a descent. #172

Closed
orejolaphet opened this issue Jul 29, 2014 · 11 comments
Closed

Comments

@orejolaphet
Copy link

Tested on Win7/IE10 and OSX10.9/Chrome36

The skater behaves in a weird way with "stick to track" disabled. The skater can bounce back up an incline when originally on a descent down the track.

To Reproduce:
-Select Playground Screen
-Disable "stick to track"
-Turn off friction (The bug occurs with friction, but behavior is stranger without)
-Build a line track with two pieces
screen shot 2014-07-29 at 11 31 26 am
-Curve the most left portion of the track by moving the left node up wards
-Place Skater on track
screen shot 2014-07-29 at 11 31 54 am

The skater will move down the slope, then bounce back up the slope.

@orejolaphet orejolaphet changed the title Skater can bounce back up an incline when originally on a decent. Skater can bounce back up an incline when originally on a descent. Jul 29, 2014
@samreid
Copy link
Member

samreid commented Aug 1, 2014

Thanks for this bug report. I suspect what is happening in the code is that the skater is detaching from the track, then reattaching suddenly. I'll look into it. Reassigned to @samreid.

@samreid samreid self-assigned this Aug 1, 2014
@samreid
Copy link
Member

samreid commented Aug 6, 2014

It looks like this problem may be caused by the solution to #142

@samreid
Copy link
Member

samreid commented Aug 6, 2014

It is pretty easy to reproduce this problem based on the instructions above. I think we may need to (a) find out why the skater is detaching from the track when it would just immediately recollide, or (b) add a rule that prevents the skater from reattaching from a time/point close to where it detached (as in #142).

samreid added a commit that referenced this issue Aug 7, 2014
@samreid
Copy link
Member

samreid commented Aug 7, 2014

In the above commit, I added code to make sure the skater won't collide with the track again before allowing the skater to detach, and it appears to have solved this problem. I tested a number of other cases where the skater falls off/jumps off the track and didn't see any errant behavior. However, this should be tested thoroughly since it may introduce other problematic scenarios.

@samreid samreid removed their assignment Aug 7, 2014
@orejolaphet
Copy link
Author

@samreid I tested the case described above and the issue is no longer present. I will check for other scenarios where this bug may occur.

@bryo5363
Copy link

@samreid This issue seems to be fixed but there is another issue that is quite similar to this. When creating a loop and disabling stick to track, the skater sometimes will flip onto the other side of the track.

@orejolaphet
Copy link
Author

https://drive.google.com/file/d/0B1dDzrtWHaLbdnV1VXdQakF1c1U/edit?usp=sharing

I'm working on a method of reproducing the error, but I came across this testing 1.0.0-rc.14

@samreid samreid assigned samreid and unassigned orejolaphet Aug 20, 2014
@samreid
Copy link
Member

samreid commented Aug 21, 2014

Good bug find. I think the skater is detaching from the track then reattaching immediately. We should solve this by doing 1 and or 2 below:

  1. Make sure the velocity direction is preserved when reattaching to the track, perhaps there is a problem sometimes when tracks or skaters are upside down
  2. Make it so the skater cannot reattach to the track so soon after detaching

@samreid
Copy link
Member

samreid commented Aug 21, 2014

To solve (1) above, perhaps it would be sufficient to check the velocity vector before and after attachment and make sure their dot product is positive.

@samreid
Copy link
Member

samreid commented Aug 23, 2014

I added logic above to invert the parametric velocity if the 2d velocities mismatch before/after attachment. This should be tested vigorously.

@phet-steele
Copy link
Contributor

No longer saw this in 1.0.0-dev.55 while testing on Win 8/Chrome 37 and iPad2&3 iOS 7.1/Safari 9537.53

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants