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

ex.Actor.body.oldPos not being set #666

Closed
eonarheim opened this issue Oct 6, 2016 · 1 comment
Closed

ex.Actor.body.oldPos not being set #666

eonarheim opened this issue Oct 6, 2016 · 1 comment
Assignees
Labels
bug This issue describes undesirable, incorrect, or unexpected behavior good first issue good for people new to open source and Excalibur
Milestone

Comments

@eonarheim
Copy link
Member

Steps to Reproduce

No matter want position an ex.Actor.body.pos takes on over time ex.actor.body.oldPos stays at (0, 0)

Expected Result

oldPos should take on the value of pos from the previous frame

@eonarheim eonarheim added bug This issue describes undesirable, incorrect, or unexpected behavior good first issue good for people new to open source and Excalibur labels Oct 6, 2016
@eonarheim eonarheim added this to the 0.8.0 Release milestone Oct 6, 2016
@kamranayub kamranayub self-assigned this Oct 11, 2016
@kamranayub
Copy link
Member

Two issues I discovered:

  1. oldVel was wrong, it was being set to the current frame's value
  2. oldVel (and now oldPos) are being set in the integrate() method of Actor but that method can be called multiple times per update, hence oldVel and oldPos are probably not accurate for use within an update loop especially if they are supposed to represent the previous frame values.

jedeen pushed a commit that referenced this issue Oct 31, 2016
Closes #666 
## Proposed Changes:
- Fix `oldVel` value being set to the current frame's value due to `addEqual` mutator method
- Fix `oldPos` not being set at all
## Notes
Two issues I discovered:
1. `oldVel` was wrong, it was being set to the current frame's value
2. `oldVel` (and now `oldPos`) are being set in the `integrate()` method of Actor but that method can be called multiple times per update, hence oldVel and oldPos are probably not accurate for use within an update loop especially if they are supposed to represent the previous frame values.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue describes undesirable, incorrect, or unexpected behavior good first issue good for people new to open source and Excalibur
Projects
None yet
Development

No branches or pull requests

2 participants