SetObjectAnimatedTexture: Difference between revisions

From Onset Developer Wiki
No edit summary
No edit summary
Line 17: Line 17:
[[File:AnimatedBanana.PNG|300px]]
[[File:AnimatedBanana.PNG|300px]]
<syntaxhighlight lang="Lua">
<syntaxhighlight lang="Lua">
local function OnPackageStart()
AddEvent("OnObjectStreamIn", function(object)
local TextureObject = CreateObject(1, 128651.5234375, 79332.890625, 1579.2681884766)
SetObjectAnimatedTexture(TextureObject, GetPackageName().."/client/files/AnimatedBanana.PNG", 2, 4)
local modelid = GetObjectModel(object)
end
 
AddEvent("OnPackageStart", OnPackageStart)
if modelid == 1 then
SetObjectAnimatedTexture(object, GetPackageName().."/client/files/AnimatedBanana.PNG", 2, 4)
end
 
end)
</syntaxhighlight>
</syntaxhighlight>



Revision as of 12:03, 11 June 2020

SetObjectAnimatedTexture

Type: Function
Context: Client
Introduced: v1.0

Description

Sets a flipbook texture on an object.

Syntax

SetObjectAnimatedTexture(object, TextureFile, Rows, Columns [, MaterialSlot])

Parameters

  • object
    The object identifier.
  • TextureFile
    The files in your package directory.
  • Rows
    Number of rows of your flipbook texture.
  • Columns
    Number of columns of your flipbook texture.
  • MaterialSlot (optional)
    The objects model material slot.

Return Value

  • Returns true on success.

Example

AddEvent("OnObjectStreamIn", function(object)
	
	local modelid = GetObjectModel(object)

	if modelid == 1 then
		SetObjectAnimatedTexture(object, GetPackageName().."/client/files/AnimatedBanana.PNG", 2, 4)
	end

end)

See also