-
-
Notifications
You must be signed in to change notification settings - Fork 78
ParaObject
Li, Xizhi edited this page Mar 7, 2017
·
7 revisions
ParaObject is the scripting proxy to a 3D object on the C++ engine. In most cases, it could be a 3d mesh, an animated character called biped, a bmax model or any custom 3D objects.
Use CreateCharacter
to create animated character based on a ParaX asset file.
local player = ParaScene.CreateCharacter ("MyPlayer", ParaAsset.LoadParaX("","character/v3/Elf/Female/ElfFemale.x"), "", true, 0.35, 0, 1.0);
player:SetPosition(ParaScene.GetPlayer():GetPosition());
ParaScene.Attach(player);
Use CreateMeshPhysicsObject
to create a static mesh object based on a mesh asset file
local asset = ParaAsset.LoadStaticMesh("","model/common/editor/z.x")
local obj = ParaScene.CreateMeshPhysicsObject("blueprint_center", asset, 1,1,1, false, "1,0,0,0,1,0,0,0,1,0,0,0");
obj:SetPosition(ParaScene.GetPlayer():GetPosition());
obj:GetAttributeObject():SetField("progress",1);
ParaScene.Attach(obj);
Please note all asset are async-loaded, when asset is not loaded, object renders nothing, and following parameters may not be correct when associated mesh asset is not async-loaded.
local obj = ParaScene.GetObject("MyPlayer")
local params = {};
param.rotation = obj:GetRotation({})
param.scaling = obj:GetScale();
param.facing = obj:GetFacing();
param.ViewBox = obj:GetViewBox({});
local x,y,z = obj:GetViewCenter();
More Complete API reference, please see ParaObject Reference
Download Paracraft | ParacraftSDK | copyright by tatfook 2016 | upload image