Jump to content

Bone_attach problem


JeViCo

Recommended Posts

Hello everyone! i use this code to change player's rotation:

function updateCamera()
	x,y,z,tx,ty,tz =  getCameraMatrix()
	newangle = (( 360 - math.deg ( math.atan2 ( ( x - tx ), ( y - ty ) ) ) ) % 360)-180
	setElementRotation( localPlayer,0,0, -newangle )
end
addEventHandler ( "onClientPreRender", getRootElement(), updateCamera )

also i use bone_attach resource to attach the object to a player. When a player rotates - object rotates too but in opposite direction and i don't know why.

How can i fix it?

Link to comment
23 minutes ago, JeViCo said:

Hello everyone! i use this code to change player's rotation:


function updateCamera()
	x,y,z,tx,ty,tz =  getCameraMatrix()
	newangle = (( 360 - math.deg ( math.atan2 ( ( x - tx ), ( y - ty ) ) ) ) % 360)-180
	setElementRotation( localPlayer,0,0, -newangle )
end
addEventHandler ( "onClientPreRender", getRootElement(), updateCamera )

also i use bone_attach resource to attach the object to a player. When a player rotates - object rotates too but in opposite direction and i don't know why.

How can i fix it?

use

setElementAttachedOffsets / getElementAttachedOffsets

 

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...