Jump to content

Recommended Posts

Posted

    

pls how true code , i bad coder.

    local world1 = Entity:GetWorld() --error 0 
    
    local pref = Entity LoadPrefab(self.world1, "pref/test_obj.pfb") -- true
    
    self.pref:Move(0.0,0.0,0.0) -- error 1

 

Posted

no, i make folder "Entity->guntils" . in folder. new script. if i not true coding. sry, i not pro :-)

 

full code 

-- source_code: \test_lua_scene\Scripts\Entities\GUntils\MgetWorld.lua
MgetWorld = {}

local world0 = CreateWorld()

local world1 = Entity:GetWorld()

--MgetWorld.world1 = Entity:GetWorld()

--function MgetWorld:Loader(mapNameExteriorList) --argv map
--	
--end


function MgetWorld:Start()
	--if world0 == nil or pref == nil then 
	--	Print("error : MgetWorld -> not path or world ")
	--	return 0
	--end
	
	local pref = Entity LoadPrefab(self.world1, "pref/test_obj.pfb")
	self.pref:Move(0.0,0.0,0.0)

	Print("MgetWorld : done")
	
end


function MgetWorld:Update()
    
end

--RegisterComponent("MgetWorld", MgetWorld)

--return MgetWorld

 

Posted

You should not create a new world in an entity script. The world is already created for you.

MgetWorld = {}

function MgetWorld:Start()  
	self.pref = LoadPrefab(self.world, "pref/test_obj.pfb")
	if self.pref ~= nil then
		self.pref:Move(0.0, 0.0, 0.0)
		Print("MgetWorld : done")
	end
end

function MgetWorld:Update()
    
end

 

Let's build cool stuff and have fun. :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...