SetObjectAnimatedTexture: Difference between revisions

From Onset Developer Wiki
No edit summary
No edit summary
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Info|Function|Server|1.0}}
{{Info|Function|Client|1.0}}


{{FuncDescription|__EDIT_ME__}}
{{FuncDescription|Sets a flipbook texture on an object.}}


{{FuncSyntax|SetObjectAnimatedTexture(object, TextureFile, Rows, Columns [, MaterialSlot])}}
{{FuncSyntax|SetObjectAnimatedTexture(object, TextureFile, Rows, Columns [, MaterialSlot])}}


{{FuncParameters}}
{{FuncParameters}}
{{FuncParam|object|__EDIT_ME__}}
{{FuncParam|object|The object identifier.}}
{{FuncParam|TextureFile|__EDIT_ME__}}
{{FuncParam|TextureFile|The files in your package directory.}}
{{FuncParam|Rows|__EDIT_ME__}}
{{FuncParam|Rows|Number of rows of your flipbook texture.}}
{{FuncParam|Columns |__EDIT_ME__}}
{{FuncParam|Columns|Number of columns of your flipbook texture.}}
{{FuncParamOptional|MaterialSlot|__EDIT_ME__}}
{{FuncParamOptional|MaterialSlot|The objects model material slot. Default: 0}}


{{FuncReturnValue|__EDIT_ME__}}
{{FuncReturnValue|Returns '''true''' on success.}}


== Example ==
== Example ==
__EDIT_ME__
[[File:AnimatedBanana.PNG|300px]]
<syntaxhighlight lang="Lua">
AddEvent("OnObjectStreamIn", function(object)
local modelid = GetObjectModel(object)
 
if modelid == 1 then
SetObjectAnimatedTexture(object, GetPackageName().."/client/files/AnimatedBanana.PNG", 2, 4)
end
 
end)
</syntaxhighlight>


{{RelatedFunctions}}
{{RelatedFunctions}}
__EDIT_ME__
* [[GetObjectCount]]
* [[GetObjectModelCount]]
* [[GetObjectModelGroup]]
* [[GetObjectModelName]]
* [[GetStreamedObjects]]
* [[GetObjectModel]]
* [[GetObjectLocation]]
* [[GetObjectRotation]]
* [[GetObjectScale]]
* [[GetObjectBoundingBox]]
* [[GetObjectSize]]
* [[EnableObjectHitEvents]]
* [[GetObjectMass]]
* [[SetObjectEditorSpeed]]
* [[SetObjectEditable]]
* [[SetObjectOutline]]
* [[SetObjectCastShadow]]
* [[SetObjectColor]]
* [[SetObjectEmissiveColor]]
* [[SetObjectTexture]]

Latest revision as of 11:07, 1 September 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. Default: 0

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