hiroto
April 20, 2024, 7:33pm
1
Godot Version
Godot 3.5
Question
The HTML5 export of my project messes up changes in position and scale.
What is going on?
I am guessing it might have to do with using delta
, but I am not sure. Am I using it wrong?
Relevant Code Snippet
func rescale(delta):
var rescaling_amount = self.scale.x * rescaling * delta
self.scale.x += rescaling_amount
self.scale.y += rescaling_amount
func _process(delta):
vel += accel * delta
self.position.y += vel
rescale(delta)
HTML5 export running:
The rock and banner move slower and re-scale faster.
What it looks like when running in godot:
The stone and banner should be increasing in scale slowly.
editor-run-no-bug|271x499
hiroto
April 20, 2024, 7:34pm
2
Here is the GIF proper of how it should be working (new users can’t display more than one per post)
I think it is because Godot PC has a low delta ( < 1 ) so it scales down the exponent on the “self.scale.x”
While HTML has a higher delta ( > 1 ) so it grows exponentially
maybe remove the “self.scale.x” in the rescaling_amount and try to tweak the rescaling instead
hiroto
April 20, 2024, 9:36pm
4
Isn’t Delta the milliseconds between frames? To have delta > 1, wouldn’t the game be running at 1 fps?
sorry for the confusion I meant the rescaling_amount < 1
also, you have 2 different scaling for the position and scale
~ self.scale.x = self.scale.x + self.scale.x * rescaling * delta
~ self.position.y = self.position.y + accel * delta * (t + 1)
Therefore you have different behaviors between the scale and position
hiroto
April 21, 2024, 12:04am
7
Yes, it is no issue that those two have different behavior.
The issue is the difference between the HTML and the in engine build.
system
Closed
May 23, 2024, 5:18pm
9
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.