Swimer Posted February 20, 2022 Share Posted February 20, 2022 I have a small code that aims to find a car or a player, but the ray starts moving from the camera and crashes into my player, how do I cancel the collision with MY character? if not isPedInVehicle(localPlayer) then local hit, x, y, z, elementHit = processLineOfSight ( ppx, py, pz, tx, ty, tz ) if hit then if elementHit then local sX, sY = getScreenFromWorldPosition( getElementPosition(elementHit) ) -- dxDrawText("G", sX, sY, sX, sY, tocolor(255, 255, 255), 1, "default") dxDrawImage(sX-16*px, sY-16*px, 32*px, 32*px, "assets/icons/PlayerInteract.png") if not (target == elementHit) then target = elementHit end else if target then target = nil end end else if target then target = nil end end end Link to comment
βurak Posted February 20, 2022 Share Posted February 20, 2022 (edited) I'm not sure but you can try this if(elementHit ~= localPlayer) then end Edited February 20, 2022 by Burak5312 Link to comment
Swimer Posted February 20, 2022 Author Share Posted February 20, 2022 3 minutes ago, Burak5312 said: I'm not sure but you can try this if(elementHit ~= localPlayer) then end I need to get an object that is in front of the camera, but since GTA is a third-person game, the player’s neck or head is almost always in front of the camera, so I need ray to skip my player and continue moving on. Link to comment
βurak Posted February 20, 2022 Share Posted February 20, 2022 Can you try using the ignoredElement parameter processLineOfSight(px, py, pz, tx, ty, tz, true, true, true, true, true, false, false, false, localPlayer) 2 Link to comment
Swimer Posted February 20, 2022 Author Share Posted February 20, 2022 8 minutes ago, Burak5312 said: Can you try using the ignoredElement parameter processLineOfSight(px, py, pz, tx, ty, tz, true, true, true, true, true, false, false, false, localPlayer) Aahahahahah. Nice. Topic closed. Thank you 2 Link to comment
Administrators Tut Posted February 20, 2022 Administrators Share Posted February 20, 2022 Closing this as has been resolved Link to comment
Recommended Posts