Comments (5)
A simple fix to this issue would be adding a new parameter called something like "keep previous transform". This allows rotation and scale of the node to be edited, while still not affecting any things that are enabled.
Under process, it would be
func _process(_delta):
var f = Engine.get_physics_interpolation_fraction()
var tr: Transform3D
if SF_KEEPTRANSFORM:
tr = transform
else:
tr = Transform3D()
instead of:
func _process(_delta):
var f = Engine.get_physics_interpolation_fraction()
var tr: Transform3D = Transform3D()
from smoothing-addon.
I discuss this in this video for the core interpolation in 3.x:
https://www.youtube.com/watch?v=BJgDCISku_o&t=126s
For FPS camera and the addon, sometimes it can be better to keep the camera on a separate branch to the player, and manually interpolating in global space. Attaching the camera as a child of a (basis) smoothed player visual rep won't work well as you say, because the smoothed basis will likely be inherited from the parent, unless you turn off basis interpolation.
Typically in FPS you'd want to drive the rotation of the player (rather than the camera directly) using the mouse, so if you turn off basis interpolation in the player, and just alter the yaw of the player directly using the mouse (and thus inherited by a camera child) this may work for you. The pitch on the other hand might be applied directly to the camera, so the player rep is always level but the camera looks up and down. The exact setup depends on the nature of your game / camera.
from smoothing-addon.
That is correct, but it does allow for some more freedom. With this approach, my "Player" node can stay as a CharacterBody3D, which allows positional
smoothing without smoothing its rotation, allowing for exact control over the camera.
from smoothing-addon.
Ah sorry, I get what you mean. This may well be an oversight on my part, will look into it when I get a moment. 👍 😃
from smoothing-addon.
I've managed to solve this problem by modifying the addon. Since my player is translated on the physics tick but rotated on the process tick, I needed a way to selectively apply interpolation on a per-property basis. To do so, I made this change:
func _process(_delta):
var f = Engine.get_physics_interpolation_fraction()
var tr: Transform3D = Transform3D()
# translate
if _TestFlags(SF_TRANSLATE):
var ptDiff = _m_trCurr.origin - _m_trPrev.origin
tr.origin = _m_trPrev.origin + (ptDiff * f)
+ else:
+ tr.origin = _m_Target.global_transform.origin
# rotate
if _TestFlags(SF_BASIS):
if _TestFlags(SF_SLERP):
tr.basis = _m_trPrev.basis.slerp(_m_trCurr.basis, f)
else:
tr.basis = _LerpBasis(_m_trPrev.basis, _m_trCurr.basis, f)
+ else:
+ tr.basis = _m_Target.global_transform.basis
transform = tr
I'm not sure if this was the intention initially, but disabling the basis
or translate
flag OOTB causes the transform to never be applied at all. With the change, I can configure the smoothing node to only interpolate translate
but leave basis
as-is.
from smoothing-addon.
Related Issues (20)
- Error: Basis must be normalized in order to be caster to a Quaternion... HOT 1
- Unable to YSort sprites underneath the smoothing node on a Player with tilemap. HOT 11
- Attaching Control under Smoothing2D causes assert error: _SetProcessing(): Condition "!viewport" is true on set_as_top_level HOT 2
- On Windows: Unable to load addon script from path. This might be due to a code error in that script. HOT 7
- Can't import to Godot 4.x HOT 2
- Is this different to 3.5's physics interpolation? HOT 4
- Flip being smoothed HOT 5
- Visibility not propagated since changing to using toplevel HOT 1
- Activation of Snaps causes unsmoothed visual jitter HOT 6
- Heavy jitter from Camera2D scroll on Godot 4.2 (beta1) HOT 5
- How to use toplevel in 2D HOT 2
- Jitter with moving player HOT 2
- godot 4 low process priority causes stutter HOT 5
- problem with spawning scene with smoothing HOT 7
- Visible jitter when instantly moving player. HOT 1
- Addon helps but doesn't completely solve jitter. Unsure if issue or user error. HOT 1
- Thank you for this addon!!!!!!
- "Ghosting" effect when hide and show object HOT 2
- Camera stuttering with rigidbody 3d HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from smoothing-addon.