SetPedLookAt: Difference between revisions
Jump to navigation
Jump to search
(New page: __NOTOC__ {{Client function}} Makes a ped turn his head and look at a specific world position or element. ==Syntax== <syntaxhighlight lang="lua"> bool setPedLookAt ( ped thePed, float x, float y, float z...) |
(Added example (untested)) |
||
Line 18: | Line 18: | ||
*'''time:''' the time, in milliseconds, during which the ped will look at the target. Once this time has elapsed, he will look ahead again like before the function was applied. A time of 0 will immediately stop any lookat. A negative time will make the ped look at the target indefinitely. | *'''time:''' the time, in milliseconds, during which the ped will look at the target. Once this time has elapsed, he will look ahead again like before the function was applied. A time of 0 will immediately stop any lookat. A negative time will make the ped look at the target indefinitely. | ||
*'''target:''' if this argument is specified, the position arguments will be ignored and the ped's gaze will follow the specified element instead. Can be a player, a vehicle, another ped etc. | *'''target:''' if this argument is specified, the position arguments will be ignored and the ped's gaze will follow the specified element instead. Can be a player, a vehicle, another ped etc. | ||
==Example== | |||
This example makes player to always see where the camera points at (untested, but should work). | |||
<syntaxhighlight lang="lua"> | |||
function setPedLookAtCameraTargetPosition() | |||
local sx,sy,sz,tx,ty,tz,v1,v2 = getCameraMatrix() | |||
setPedLookAt (getLocalPlayer(),tx,ty,tz,3000) | |||
end | |||
addEventHandler("onClientRender",getRootElement(),setPedLookAtCameraTargetPosition) | |||
</syntaxhighlight> | |||
==See Also== | ==See Also== | ||
{{Client ped functions}} | {{Client ped functions}} |
Revision as of 19:44, 26 December 2010
Makes a ped turn his head and look at a specific world position or element.
Syntax
bool setPedLookAt ( ped thePed, float x, float y, float z [, int time = 3000, element target ] )
Required Arguments
- thePed: the ped to change the lookat of.
- x: the x coordinate of the world position to look at.
- y: the y coordinate of the world position to look at.
- z: the z coordinate of the world position to look at.
Optional Arguments
- time: the time, in milliseconds, during which the ped will look at the target. Once this time has elapsed, he will look ahead again like before the function was applied. A time of 0 will immediately stop any lookat. A negative time will make the ped look at the target indefinitely.
- target: if this argument is specified, the position arguments will be ignored and the ped's gaze will follow the specified element instead. Can be a player, a vehicle, another ped etc.
Example
This example makes player to always see where the camera points at (untested, but should work).
function setPedLookAtCameraTargetPosition() local sx,sy,sz,tx,ty,tz,v1,v2 = getCameraMatrix() setPedLookAt (getLocalPlayer(),tx,ty,tz,3000) end addEventHandler("onClientRender",getRootElement(),setPedLookAtCameraTargetPosition)
See Also
- canPedBeKnockedOffBike
- getPedAnalogControlState
- getPedAnimation
- getPedBonePosition
- getPedCameraRotation
- getPedControlState
- getPedMoveState
- getPedOxygenLevel
- getPedSimplestTask
- getPedTargetCollision
- getPedTargetEnd
- getPedTargetStart
- getPedTask
- getPedVoice
- getPedWeaponMuzzlePosition
- givePedWeapon
- isPedBleeding
- isPedDoingTask
- isPedReloadingWeapon
- isPedTargetingMarkerEnabled
- setAnalogControlState
- setPedAimTarget
- setPedAnalogControlState
- setPedBleeding
- setPedCameraRotation
- setPedCanBeKnockedOffBike
- setPedControlState
- setPedEnterVehicle
- setPedExitVehicle
- IsPedFootBloodEnabled
- setPedFootBloodEnabled
- setPedLookAt
- setPedOxygenLevel
- setPedTargetingMarkerEnabled
- setPedVoice
- Shared
- addPedClothes
- getPedClothes
- removePedClothes
- createPed
- getPedAmmoInClip
- getPedArmor
- getPedFightingStyle
- getPedOccupiedVehicle
- getPedOccupiedVehicleSeat
- getPedStat
- getPedTarget
- getPedTotalAmmo
- getPedWalkingStyle
- getPedWeapon
- getPedWeaponSlot
- getPedContactElement
- getValidPedModels
- isPedChoking
- isPedDead
- isPedDoingGangDriveby
- isPedDucked
- isPedHeadless
- isPedInVehicle
- isPedOnFire
- isPedOnGround
- isPedWearingJetpack
- killPed
- removePedFromVehicle
- setPedAnimation
- setPedAnimationProgress
- setPedAnimationSpeed
- setPedArmor
- setPedDoingGangDriveby
- setPedFightingStyle
- setPedHeadless
- setPedOnFire
- setPedStat
- setPedWalkingStyle
- setPedWeaponSlot
- warpPedIntoVehicle