Repository navigation
Description
Discuss about rvx, rvy in collection-map.js
there is a function with arguments named rvx, rvy , What do they mean? what's the full name ?
Impact/lib/impact/collision-map.js
Line 63 in 7768fd2
| _traceStep: function( res, x, y, vx, vy, width, height, rvx, rvy, step ) { |
the _traceStep() be called with vx & vy
Impact/lib/impact/collision-map.js
Line 44 in 7768fd2
| this._traceStep( res, x, y, sx, sy, objectWidth, objectHeight, vx, vy, i ); |
Why do you pass vx , vy ? in my opinion , at line 44 , It should pass sx ,sy
the function _traceStep has arguments rvx, rvy , and pass them into _checkTileDef()
Impact/lib/impact/collision-map.js
Line 95 in 7768fd2
| this._checkTileDef(res, t, x, y, rvx, rvy, width, height, prevTileX, tileY) |
Impact/lib/impact/collision-map.js
Line 104 in 7768fd2
| (t > 1 && this._checkTileDef(res, t, x, y, rvx, rvy, width, height, tileX, tileY)) // slope? |
Impact/lib/impact/collision-map.js
Line 142 in 7768fd2
| this._checkTileDef(res, t, x, y, rvx, rvy, width, height, tileX, prevTileY) ) { |
Impact/lib/impact/collision-map.js
Line 150 in 7768fd2
| (t > 1 && this._checkTileDef(res, t, x, y, rvx, rvy, width, height, tileX, tileY)) // slope? |
Why do you pass rvx , rvy ? in my opinion , at line 44 , It should pass vx ,vy.
I post a PR , Just for comparing the differences in the code
https://github.com/phoboslab/Impact/pull/100/files
If change the code to my version, will there be any problems?
Activity
for Discuss phoboslab#99
Joncom commentedon Mar 25, 2025
Joncom commentedon Mar 25, 2025
finscn commentedon Mar 26, 2025
because I think rvx rvy is useless , I removed them from _traceStep()'s definition
Joncom commentedon Mar 26, 2025
phoboslab commentedon Mar 26, 2025
rvxandrvyist the "real velocity"._traceStep is called like this:
Impact/lib/impact/collision-map.js
Lines 40 to 44 in 7768fd2
This is passing the velocity for one step (
sx,synamedvx,vyin_traceStep) and the real/full velocity of the object (vx,vynamedrvx,rvyin_traceStep). The real velocity is not needed for collision detection, but later (incheckTileDef) for resolving the collision.Simple example: you hit the ground at an angle. The resolved y position will be the impact position, the x position however will incorporate the x velocity, essentially sliding you over the ground. Here the real x velocity is needed, not the x velocity for just one step of collision detection.
finscn commentedon Mar 27, 2025
@phoboslab thanks .
but if use real/full velocity , the target point ( x+ rvy , y+ rvy) or it's pedal may be out of the slope-tile's bounding .
should we use the red point ?
Huaian666 commentedon Jun 5, 2026
Huaian666 commentedon Jun 6, 2026