We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I made such a function according to the formula and called it before updating.
function applyG(body){ for(let i of Composite.allBodies(engine.world)){ if(i===body){ continue; } let F=__gravitational__*body.mass*i.mass/(distance2body(body,i)**2); let p=Vector.sub(i.position,body.position); let Fg=Vector.mult(p,F/(p.x**2+p.y**2)**0.5); body.force.x+=Fg.x body.force.y+=Fg.y } function distance2body(b1,b2){ let s=Vector.sub(b1.position,b2.position); return (s.x**2+s.y**2)**0.5; } } Events.on(runner, "beforeUpdate", ()=>{ for(let i of Composite.allBodies(engine.world)){ applyG(i) } });
But when I set a rigid body and set a linear velocity to make it run on a circular track, the linear velocity always seems too small.
Body.setVelocity(ball,{x:(__gravitational__*earth.mass/distance2body(earth.position,ball.position))**0.8,y:0})
When near a celestial body, the calculated linear velocity is approximately 70, but in reality, a linear velocity of 1100 is needed to make it orbit.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I made such a function according to the formula and called it before updating.
But when I set a rigid body and set a linear velocity to make it run on a circular track, the linear velocity always seems too small.
When near a celestial body, the calculated linear velocity is approximately 70, but in reality, a linear velocity of 1100 is needed to make it orbit.
The text was updated successfully, but these errors were encountered: