so far I have this:
a function to get the positions of the entities
every second
a function to calculate the speed
this function applies the forces
when the ships collide at certain angles its realistic but at other angles they bounce in the opposite direction they should,so I think the problem is with plus and minus
Function Calc_Speed() If time>speed_timer+1000 For s.ship=Each ship s\old_x=s\new_x s\new_x=EntityX(s\ship_handle,1) s\old_y=s\new_y s\new_y=EntityY(s\ship_handle,1) s\old_z=s\new_z s\new_z=EntityZ(s\ship_handle,1) Next speed_timer=time EndIf End Function
a function to get the positions of the entities
every second
Function Get_speed#(ship1,axis) s.ship=Object.ship(EntityName(ship1)) If axis=x Return Float ((s\new_x-s\old_x)/10) EndIf If axis=y Return Float ((s\new_y-s\old_y)/10) EndIf If axis=z Return Float ((s\new_z-s\old_Z)/10) EndIf End Function
a function to calculate the speed
Function Ship_Collision(ship1,ship2) s.ship=Object.ship(ship2) collider=ship1 xspeed#=Get_speed(collider,x)-get_speed(s\ship_handle,x) yspeed#=get_speed(collider,y)-get_speed(s\ship_handle,y) zspeed#=get_speed(collider,z)-get_speed(s\ship_handle,z) translateentity s\ship_handle,xspeed,yspeed,zspeed End Function
this function applies the forces
when the ships collide at certain angles its realistic but at other angles they bounce in the opposite direction they should,so I think the problem is with plus and minus