2 Collision Problems

Blitz3D Forums/Blitz3D Programming/2 Collision Problems

Kryzon(Posted 2008) [#1]
Hello fellow B3D users,
I've been having quite some difficulty now with a racing game I'm making...I have the racing car model, the track, and I want both of them to collide. Funnily enough, simply putting
EntityType Car,1
EntityType Track,2

Collisions 1,2,2,2

Won't even give a sign of life. The cars do collide between eachother, though, but my greatest interest is with the track.
Well, besides the frustration, I got a second question:
Since my track is not only curvy along the X and Z axis (it goes up as well), I've been meaning to find a way to make the car align with whatever face is below him, thus aligning with the track. Now, the only way I thought of that was to create a Pivot, place it below the car, parent it to the car, set a collision\radius to it, move it some 4 units down (so it collides with the track), and then as long as the game goes I'd move it down, get the collision normal and align it with AlignToVector on the Y axis, so the car would follow as well. Is there any other (easier or harder, but with best results) way to do this?

Thank you for your time,
Rafael.


PS: I've posted the vehicles as 'cars', but in fact they are hovering vehicles such as the ones in WipeOut 64 (the main source of inspiration for my remake). I am planning to use Sin on the ship's Y axis in order to wave around like the vehicle is floating.


D4NM4N(Posted 2008) [#2]
Have a look at the car/driver example included in the b3d samples. I think it contains the system you are looking for.

From your collision layout above i dont understand why the cars are colliding with each other as you would need to add "collisions 1,1.." to do that. Are you sure the cars are working and you have an updateworld in the loop?


Kryzon(Posted 2008) [#3]
The cars did collide with eachother, and that's fine. The problem is really they colliding with the track or it's borders or anything related to it, it just won't happen, they just go through it.


Kryzon(Posted 2008) [#4]
Nevermind, I solved it...The B3D Pipeline exports the Scene root above all, and I was aplying the Entity Collision directly to it, instead of the Level mesh that is one of its childs. Simply selecting it with FindChild and applying collision to it worked.
Beware of the Children!


The topic may be closed now.


Mortiis(Posted 2008) [#5]
Use this. It's a recursive function that adds the entity type to the entity
and all of it's children. Applying it only to the scene root may cause
problems.

Function EntityType_(entity, collisiontype)
	EntityType entity, collisiontype
	For c = 1 To CountChildren(entity)
		EntityType_(GetChild(entity, c), collisiontype)
	Next
End Function



Kryzon(Posted 2008) [#6]
Thanks for that snippet, mortiis.