Hi,
I created a testscene with 2 spheres.
First I tried to move the right sphere towards the left sphere and to let it stop on impact.
That worked.
Then I also let the left sphere move away from the right sphere a bit slower than the right one (so they can collide).
They collided and the right sphere just followed the left one at the same speed, because it was always bumping into the left one.
At last I tried moving them towards each other and they moved right through each other.
I tried to use 2 UpdateWorlds (move the right sphere, updateworld, move left sphere, updateworld), without succes.
Then I assigned some sort of two-way collisions, that worked.
Is that the way to go, when you have 2 moving objects and you want each of them to collide with each other?
As I'm trying to create a spacesim, but the AI must be able to collide with you, and you with the AI-ships.
Doesn't this create a huge drop in performance, if you have about 30 ships in view, each colliding with each other?
Also, could I do this?
So each AI-ship can collide with each AI-ship, without one ship passing through another one (uncollided).
I know it would be better to create a good collision-avoiding routine, but just in case they would collide (would seem like a bug for most players who would play your game) if AI-ships don't collide with each other.
I created a testscene with 2 spheres.
First I tried to move the right sphere towards the left sphere and to let it stop on impact.
That worked.
Then I also let the left sphere move away from the right sphere a bit slower than the right one (so they can collide).
They collided and the right sphere just followed the left one at the same speed, because it was always bumping into the left one.
At last I tried moving them towards each other and they moved right through each other.
I tried to use 2 UpdateWorlds (move the right sphere, updateworld, move left sphere, updateworld), without succes.
Then I assigned some sort of two-way collisions, that worked.
Is that the way to go, when you have 2 moving objects and you want each of them to collide with each other?
As I'm trying to create a spacesim, but the AI must be able to collide with you, and you with the AI-ships.
Graphics3D 800, 600, 0, 2 SetBuffer BackBuffer() ; Create objects sphere1 = CreateSphere(100) sphere2 = CreateSphere(100) camera = CreateCamera() light = CreateLight(2) ; Position objects PositionEntity sphere1, 5, 0, 0 PositionEntity sphere2, 0, 0, 0 PositionEntity camera, 0, 0, -10 PositionEntity light, 0, 10, -10 ; Set collision types Sphere_Left = 1 Sphere_Right = 2 EntityType sphere1, Sphere_right EntityType sphere2, Sphere_Left ; Set collision radius EntityRadius sphere1, 1 EntityRadius sphere2, 1 ; Set collisions Collisions Sphere_Right, Sphere_Left, 1, 1 ; Let right sphere collide with the left one Collisions Sphere_Left, Sphere_Right, 1, 1 ; Let left sphere collide with the right one While Not KeyHit(1) Cls MoveEntity sphere1, -0.025, 0, 0 MoveEntity sphere2, 0.005, 0, 0 UpdateWorld RenderWorld Flip Wend End
Doesn't this create a huge drop in performance, if you have about 30 ships in view, each colliding with each other?
Also, could I do this?
; Set collisions for AI-ships AI_Ship = 3 Collisions AI_Ship, AI_Ship, 1, 1
So each AI-ship can collide with each AI-ship, without one ship passing through another one (uncollided).
I know it would be better to create a good collision-avoiding routine, but just in case they would collide (would seem like a bug for most players who would play your game) if AI-ships don't collide with each other.