Hello,
I have few questions about the raycast system (intersection).
1) I saw there is WorldIntersection, GameIntersection and PhysicsIntersection; what is the difference between them?
2) I need the intersection point and the normal, do I have to launch two raycast to get them or there is another way ?
3)
void fixedUpdate(PlayerActor& player, int addMode)
{
PhysicsIntersection intersection = new PhysicsIntersection();
PhysicsIntersectionNormal normal = new PhysicsIntersectionNormal();
vec3 start = player.getPosition();
vec3 end = start + (player.getViewDirection() * _raycastDistance);
intersection = class_cast("PhysicsIntersection",
engine.physics.getIntersection(start, end, 1, intersection));
normal = class_cast("PhysicsIntersectionNormal",
engine.physics.getIntersection(start, end, 1, normal));
if (intersection != NULL && normal != NULL)
{
vec3 pt = intersection.getPoint();
vec3 nor = normal.getNormal();
log.message("%s\n", typeinfo(pt));
_ghost.fixedUpdate(pt, nor, getCellSize(), getSelectedToolSize());
}
}
In this test, the intersection seems to work because when i don't look at something near me, i don't have debug. But when i have debug, i get something like
which is totally aberrant. The object which is raycasted is a MeshObjectStatic.
Thanks