Quote:Original post by cannonicus
You shouldnt have 2*position when you use += operator. You were right in your first post.
Crap, you're right! Oops...wow, I made a mistake! Thank you for correcting it. I'll make a note in my other posts.
Quote:Original post by cannonicus
You shouldnt have 2*position when you use += operator. You were right in your first post.
sec pos0 50.0000001 49.9990012 49.9970023 49.9940034 49.9900055 49.9850086 49.979012
void Particle::startSimulation(real dt) { prev_position = position - velocity * dt;}void Particle::Integrate(real time) { real dt = 0.01; Vector3 temp = position; position += (position - prev_position) + acceleration * dt * dt; prev_position = temp;}
void InitOpenGL() {//OpenGL Functions like glEnable ... particle.SetMass(10); particle.SetPosition(Vector3(0,3,0)); particle.SetVelocity(Vector3(0,2,0)); Physics::ApplyForce(&particle, "Gravity"); //Just add -10 to y acceleration particle.startSimulation(0.01);}void RenderOpenGL() {//Render Functions like LoadIdentity... glPointSize(particle.getMass()/0.4); //For making object real :) glBegin(GL_POINTS); glColor3f(1,0,1); glVertex3f(2,particle.getPosition().y,0); glEnd(); if(simulate) { particle.Integrate(0); } //The Texts Function (Mouse Position, Information, Simulation Button ...)}
Quote:
When i change acceleration does it need to do before simulation thing:
prev_position = position - velocity*Integration timestep, or not?
Quote:
Now the problem here is when i make acceleration positive, there comes a bug i guess so. It goes downward a little bit and then goes upward. Why? (Change the acceleration from -10 to 10 and see what happens)