Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // The type can be:
- // Everything = -1
- // Peds = 12
- // Objects = 16
- int type = -1; // Everything
- _CAST_RAY_POINT_TO_POINT(source.x, source.y, source.z, target.x, target.y, target.z, type, 0, 7)); // the target would usually be a long distance from the source in the direction you want
- int hitsomething = 0;
- int entityhandle = 0;
- Vector3 hitCoords, surfaceNormal;
- int result = _GET_RAYCAST_RESULT(handle, &hitsomething, &hitCoords, &surfaceNormal, &entityhandle);
- if(hitsomething != 0) // only execute if ray successfully hit something
- {
- if(DOES_ENTITY_EXIST(entityhandle)) // if the ray hit an entity
- {
- // any entity type checks here
- // code here
- // use entityhandle
- }
- else // if the ray hit anything other than an entity
- {
- // code here
- // use hitCoords
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement