Hi, I have two cars, and am using distance (as if they were circles) to check if they are colliding or not. Goal is to get affected by each other speed, not very interested in ading friction / mass. I don't need accuracy on the reaction, but something visible that looks "real" (for a game, that is).
After determining they have "collided" (if distance is less than radius1 + radius2 + small treshold), how can I affect their movement?
I think I need to convert angle and speed of each car to x,y components, using current speed as magnitude for the vector:
I'm using keypress to add speed or decrease, left and right turns entity +/- 1.
How can I add those external forces into my cars?
Is this approach ok?
Some other solution? (without using physics libraries).
Thanks.
After determining they have "collided" (if distance is less than radius1 + radius2 + small treshold), how can I affect their movement?
I think I need to convert angle and speed of each car to x,y components, using current speed as magnitude for the vector:
angle=entityyaw(car1,1)
cX1#=speed#*Cos(angle)
cY1#=speed#*Sin(angle); that would be z on 3d world
angle=entityyaw(car2,1)
cX2#=speed#*Cos(angle)
cY2#=speed#*Sin(angle); that would be z on 3d world
;and then add data to get resulting speed
rX#=cX1#+cX2#
rY#=cY1#+cY2#
I'm using keypress to add speed or decrease, left and right turns entity +/- 1.
How can I add those external forces into my cars?
Is this approach ok?
Some other solution? (without using physics libraries).
Thanks.