Jump to content

Bone rotation


Robiv1

Recommended Posts

local screenW, screenH = guiGetScreenSize()
local cursorX, cursorY = getCursorPosition()
cursorX, cursorY = cursorX*screenW, cursorY*screenH

local boneX, boneY, boneZ = getPedBonePosition(player, boneID)

setPedBonePosition(player, boneID, cursorX, cursorY, boneZ)

This code gets the position of the cursor on the screen using the `getCursorPosition` function, and then converts the cursor coordinates to screen coordinates using the `guiGetScreenSize` function. It then gets the position of the bone using the `getPedBonePosition` function, and finally sets the position of the bone to the cursor position using the `setPedBonePosition` function.

You will need to replace player with a reference to the `player` element, and `boneID` with the ID of the bone that you want to follow the cursor.
 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...