Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualserumas

Posted 28 September 2012 - 01:32 AM

1. I would use not velocity , but pos and last_pos, and calc velocity just in one place and not in any place there pos changes.
[source lang="cpp"]void move(){ vector2 vel=vec-last_vec; last_vec = vec*air+acceleration; vec+=vel;}[/source]
2. I would do routine with fixed dt, for example 60 fps, becouse with changing dt your verlet would be unstable, and you wouldnt need use dt in move().
[source lang="cpp"]deltatime=0; //inicializationinterval=1/60 //1/fpsmain_loop(float dt){ deltatime+=dt; iterations=(int)(deltatime/interval); deltatime=fmodf(deltatime,(float)iterations); alpha=deltatime/interval; //for smothnes on drawing for(int i=0;i < iterations;i++) { move_all_objects(); collide_all_objects(); satisfy_all_objects_constraints(); }}[/source]
3. I would make two functions insted of one move() and collide(), and in main loop will use move_all _objects() and collide_all_objects()

#6serumas

Posted 28 September 2012 - 01:14 AM

1. I would use not velocity , but pos and last_pos, and calc velocity just in one place and not in any place there pos changes.
[source lang="cpp"]void move(){ vector2 vel=vec-last_vec; last_vec = vec; vec+=vel;}[/source]
2. I would do routine with fixed dt, for example 60 fps, becouse with changing dt your verlet would be unstable, and you wouldnt need use dt in move().
[source lang="cpp"]deltatime=0; //inicializationinterval=1/60 //1/fpsmain_loop(float dt){ deltatime+=dt; iterations=(int)(deltatime/interval); deltatime=fmodf(deltatime,(float)iterations); alpha=deltatime/interval; //for smothnes on drawing for(int i=0;i < iterations;i++) { move_all_objects(); collide_all_objects(); satisfy_all_objects_constraints(); }}[/source]
3. I would make two functions insted of one move() and collide(), and in main loop will use move_all _objects() and collide_all_objects()

#5serumas

Posted 28 September 2012 - 01:13 AM

1. I would use not velocity , but pos and last_pos, and calc velocity just in one place and not in any place there pos changes.
[source lang="cpp"]void move(){ vector2 vel=vec-last_vec; last_vec = vec; vec+=vel;}[/source]
2. I would do routine with fixed dt, for example 60 fps, becouse with changing dt your verlet would be unstable, and you wouldnt need use dt in move().
[source lang="cpp"]deltatime=0; //inicializationinterval=1/60 //1/fpsmain_loop(float dt){ deltatime+=dt; iterations=(int)(deltatime/interval); deltatime=fmodf(deltatime,(float)iterations); alpha=deltatime/interval; //for smothnes on drawing for(int i=0;i<iterations;i++) { move_all_objects(); collide_all_objects(); satisfy_all_objects_constraints(); }}[/source]
3. I would make two functions insted of one move() and collide(), and in main loop will use move_all _objects() and collide_all_objects()

#4serumas

Posted 28 September 2012 - 01:12 AM

1. I would use not velocity , but pos and last_pos, and calc velocity just in one place and not in any place there pos changes.
[source lang="cpp"]void move(){ vector2 vel=vec-last_vec; last_vec = vec; vec+=vel;}[/source]

2. I would do routine with fixed dt, for example 60 fps, becouse with changing dt your verlet would be unstable, and you wouldnt need use dt in move().
[source lang="cpp"]deltatime=0; //inicializationinterval=1/60 //1/fpsmain_loop(float dt){ deltatime+=dt; iterations=(int)(deltatime/interval); deltatime=fmodf(deltatime,(float)iterations); alpha=deltatime/interval; //for smothnes on drawing for(int i=0;i<iterations;i++) { move_all_objects(); collide_all_objects(); satisfy_all_objects_constraints(); }}[/source]

3. I would make two functions insted of one move() and collide(), and in main loop will use move_all _objects() and collide_all_objects()

#3serumas

Posted 28 September 2012 - 01:08 AM

1. I would use not velocity , but pos and last_pos, and calc velocity just in one place and not in any place there pos changes.
[source lang="cpp"]void move(){ vector2 vel=vec-last_vec; last_vec = vec; vec+=vel;}[/source]

2. I would do routine with fixed dt, for example 60 fps, becouse with changing dt your verlet would be unstable, and you wouldnt need use dt in move().
3. I would make two functions insted of one move() and collide(), and in main loop will use move_all _objects() and collide_all_objects()

#2serumas

Posted 28 September 2012 - 12:52 AM

1. I would use not velocity , but pos and last_pos, and calc velocity just in one place and not in any place there pos changes.
2. I would do routine with fixed dt, for example 60 fps, becouse with changing dt your verlet would be unstable.
3. I would make two functions insted of one move() and collide(), and in main loop will use move_all _objects() and collide_all_objects()

PARTNERS