Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
freem
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Openai/68c9bd38-1494-8003-92de-0fcfb17eb8dc
(section)
Add languages
Page
Discussion
English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Assistant: Ah, entendi! === Ah, entendi! O motivo é que agora a força está muito baixa (force_strength = 80.0) e o delta de velocidade aplicado a cada frame não é suficiente para gerar movimento perceptível, especialmente com a multiplicação por dt e o amortecimento vx *= 0.95. Podemos corrigir isso de duas formas: # Aumentar ligeiramente a força para algo mais passivo mas ainda visível, por exemplo force_strength = 300. # Reduzir o amortecimento (hoje está multiplicando por 0.95 ou 0.9), para que o movimento não seja “travado” rápido demais. Além disso, o delta dt no celular pode ser muito pequeno, então podemos aplicar um fator de escala maior ao calcular a força: Vou ajustar o código para que as partículas se movimentem suavemente, mas ainda de forma passiva: <syntaxhighlight lang="python"># Parâmetros ajustáveis mais suaves time_factor = 1.0 force_strength = 300.0 # suficiente para gerar movimento root_range = 180.0 damping_center = 0.97 # amortecimento próximo do centro damping_normal = 0.99 # amortecimento normal </syntaxhighlight> No método update da partícula, substitua: <syntaxhighlight lang="python">if dist_center<50: self.vx *= 0.9 self.vy *= 0.9 else: self.vx *= 0.95 self.vy *= 0.95 </syntaxhighlight> por: <syntaxhighlight lang="python">if dist_center<50: self.vx *= damping_center self.vy *= damping_center else: self.vx *= damping_normal self.vy *= damping_normal </syntaxhighlight> Isso permite que o movimento seja mais visível, suave e passivo, mantendo o efeito de atração/repulsão. Se quiser, posso reescrever o código completo atualizado para celular, já com esses ajustes de força, amortecimento e delta de movimento, para que as partículas flutuem suavemente e sejam visíveis imediatamente. Quer que eu faça isso?
Summary:
Please note that all contributions to freem are considered to be released under the Creative Commons Attribution-ShareAlike 4.0 (see
Freem:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)