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

Refresh transform always uses local transform #29

Merged
merged 1 commit into from
Mar 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 13 additions & 22 deletions addons/smoothing/smoothing_2d.gd
Original file line number Diff line number Diff line change
Expand Up @@ -200,30 +200,21 @@ func _process(_delta):

var f = Engine.get_physics_interpolation_fraction()

if _TestFlags(SF_GLOBAL_OUT):
# translate
if _TestFlags(SF_TRANSLATE):
set_global_position(m_Pos_prev.linear_interpolate(m_Pos_curr, f))

# rotate
if _TestFlags(SF_ROTATE):
var r = _LerpAngle(m_Angle_prev, m_Angle_curr, f)
set_global_rotation(r)

if _TestFlags(SF_SCALE):
set_global_scale(m_Scale_prev.linear_interpolate(m_Scale_curr, f))
else:
# translate
if _TestFlags(SF_TRANSLATE):
set_position(m_Pos_prev.linear_interpolate(m_Pos_curr, f))
# We can always use local position rather than set_global_position
# because even in global mode we are set_as_top_level, and the result
# will be the same.

# translate
if _TestFlags(SF_TRANSLATE):
set_position(m_Pos_prev.linear_interpolate(m_Pos_curr, f))

# rotate
if _TestFlags(SF_ROTATE):
var r = _LerpAngle(m_Angle_prev, m_Angle_curr, f)
set_rotation(r)
# rotate
if _TestFlags(SF_ROTATE):
var r = _LerpAngle(m_Angle_prev, m_Angle_curr, f)
set_rotation(r)

if _TestFlags(SF_SCALE):
set_scale(m_Scale_prev.linear_interpolate(m_Scale_curr, f))
if _TestFlags(SF_SCALE):
set_scale(m_Scale_prev.linear_interpolate(m_Scale_curr, f))

pass

Expand Down