majqq

Set scale for weapon in hands

Recommended Posts

Hey, i need to scale weapon [which is custom object] in hands. Any ideas how can i do it?

Share this post


Link to post
function getPlayerWeaponAsElement(player)
	local weaps = getElementsByType('weapon')
	local x1, y1, z1 = getElementPosition(player)
	for i=1, #weaps do
		local x2, y2, z2 = getElementPosition(weaps[i])
		local distance = getDistanceBetweenPoints3D(x1, y1, z1, x2, y2, z2)
		if distance < 2 then
			return weaps[i]
		end
	end
	return false
end

No idea if something like this would work since the element type is weapon, not object, no way to set object scale.
And even though this seems pointless, getPlayerWeapon returns the players weapon slot and not the weapon its self.

What you could do is turn off visibility for the players weapon, and create an object, updating its position and rotation every frame, that way you would be able to rescale the weapon (visually that is).

Edited by ShayF

Share this post


Link to post

@majqq You can't interact with weapons directly. You should do it in common software like Zmodeller (dff) - easy way OR you can make invisible texture, create and attach custom weapon object to yourself using bone_attach functions, replace texture using shaders to make them visible again and manage it - hard way

  • Thanks 1

Share this post


Link to post

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.