GetPedTargetCollision: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
Line 15: Line 15:


==Example==
==Example==
<section name="Client" class="client" show="true">
 
This Example draws a line from where the Ped´s Target Starts to the Point where the Targets Collision is.
This Example draws a line from where the Ped´s Target Starts to the Point where the Targets Collision is.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
Line 29: Line 29:
addEventHandler("onClientPreRender",getRootElement(),drawline) -- Adds the Handler.
addEventHandler("onClientPreRender",getRootElement(),drawline) -- Adds the Handler.
</syntaxhighlight>
</syntaxhighlight>
</section>


==See Also==
==See Also==
{{Client_ped_functions}}
{{Client_ped_functions}}
[[Category:Needs_Example]]
[[Category:Needs_Example]]

Revision as of 18:18, 16 October 2013

This function allows retrieval of where a ped's target is blocked. It will only be blocked if there is an obstacle within a ped's target range.

Syntax

float float float getPedTargetCollision ( ped targetingPed )

Required Arguments

  • targetingPed: This is the ped whose target collision you wish to retrieve

Returns

Returns three floats, x,y,z, representing the position where the ped's target collides, or false if it was unsuccessful.

Example

This Example draws a line from where the Ped´s Target Starts to the Point where the Targets Collision is.

function drawline()
   if (getPedTargetStart(localPlayer)) then --Checks if there is a Point to start From.

      local x,y,z = getPedTargetStart(localPlayer) -- Gets the Point to start From.
      local sx,sy,sz = getPedTargetCollision(localPlayer) -- Gets the Point where the Targets Collision is.

      dxDrawLine3D(x,y,z,sx,sy,sz) -- Draws the Line
   end
end
addEventHandler("onClientPreRender",getRootElement(),drawline) -- Adds the Handler.

See Also