collision system
Blitz3D Forums/Blitz3D Programming/collision system
| ||
Hi ! (collision sphere-to-sphere) Man = LoadAnimMesh ("man_walk.x") Entityradius Man, 0.1 In this case and to understand blitz collision system, could i consider a virtual sphere at the _center_ of the animated mesh with a radius of 0.1 ? Next, this sphere seems to be used to check collisions with another mesh... Is is true ? Could you set the sphere center position ? How blitz determine where is the mesh center ? Many thanks ! |
| ||
In this case and to understand blitz collision system, could i consider a virtual sphere at the _center_ of the animated mesh with a radius of 0.1 ? Yes, that'c right. Next, this sphere seems to be used to check collisions with another mesh... Is is true ? Yes, right again. Could you set the sphere center position ? How blitz determine where is the mesh center ? Yes again. The centre of the mesh is the mesh's pivot point. This is the point that the mesh is rotated around in rotations. Also, when you position a mesh at 10,0,10 ( just for example ) it's the pivot of your mesh which is placed at 10,0,10. It's best to place your mesh's pivot in whatever you're using to model. The point you use as a pivot will vary according to the object you're using. In this instance, the object is a man, and you will most likely want the pivot to be right at this feet so that you can place him on the ground properly. Also, be aware that you don't need to use a mesh for the collision source. You can just as easily create a pivot in blitz and set that as your collision object and give that a radius. Then you can load the mesh and parent the mesh to your pivot. This can save a lot of headaches further down the line, as I discovered to my cost a few times till someone ( I think it was Tigerz ) set my straight. |
| ||
Many thanks Sybixsus ! |
| ||
Sybixsus, what kind of headaches? Why is having a seperate pivot better? |
| ||
"In this instance, the object is a man, and you will most likely want the pivot to be right at this feet so that you can place him on the ground properly." That isn't necessarily desireable. Doing so would make placing the character at the correct height easier but would complicate collision detection (since as you even point out the collision sphere is centered at the pivot.) Placing the pivot at the character's feet would mean half the collision sphere is below the character. This is why many games use an extra root bone to determine what height the character should be placed at. |
| ||
Well Physt, for the reason that it solves the problem Joe just illustrated. If you create a separate pivot for the collisions, you can have your collisions at the height you want them ( knee, waist, head, whatever ) and still use the centre pivot for rotation and world positioning. The other thing to bear in mind is that you're probably going to come across a situation where one set of collisions per character is not enough. If you have a pivot down low and another up at head height, you can use the collisions on both to have your character jump over things, duck under things, etc automatically. EG: collision low and high = wall - stop collision low but not high = step or low obstacle - climb over collision high but not low = low ceiling or passage - duck |
| ||
This is why many games use an extra root bone to determine what height the character should be placed at i don't understand this technic. Why a bone ? Could you explain ? |
| ||
i know that it isn't yet an character with bones, but just an hierarchy animation .x model. axis represents the mesh's pivot point (in fact i've used 3dcanvas and position from the modeler the mesh pivot to be right at this feet. |
| ||
What's the best solution to collision check with the ground without bugs ? - please ignore bones in this picture, just a quick screenshoot - in the second case the circle is not very representative imagine an 0.02 entityradius value for example. In fact, i'm just thinking that solution 2 is stupid ! Thanks ! |