Jump to content

Rotating attached object


Xwad

Recommended Posts

Hi pls help me. I want to rotate the m4 weapon when i attach it to the player but when i try it then its not rotating the attached (weapon)..

client

  
  
  
local weapon = createWeapon("m4", -2376.80, -578.50, 132.3)  
    setWeaponClipAmmo(weapon, 200) 
    setWeaponState(weapon, "ready") 
  
  
  
function bindFire () 
  local x, y, z = getElementPosition ( source ) 
  local rotX, rotY, rotZ = getElementRotation(source)     
  attachElements ( weapon, source, 0, 0.5, -0.46  ) 
  setElementRotation(weapon,rotX,rotY,rotZ+45)     <---- this is not working.. Its not rotating the weapon.. 
end 
addEvent( "bindFire", true ) 
addEventHandler( "bindFire", localPlayer, bindFire ) 

Link to comment

If that does something it looks to me it will always face the weapon to the right of the player.

Change getElementRotation(source) to getElementRotation(weapon) ... see what that does.

Its not working:// Its still looking to the right..

Don't attach it to the player, attach it to the bones of the player. It'll automatically rotate and be much more reliable

How can i make that? what function need i use?

Anyway, im trying to make this script

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