Jump to content

loaded models via lua don't get removed or move with parent.


AggrorJorn
 Share

Recommended Posts

yes... thats exactly what i mean... no reason to use a dummy mesh when you already have a perfectly good model mesh.. :) or use the house as the foundation... makes no difference...

Its frustrating, I'm at work now so I can't try out any of this stuff right now. It is a possibility (I thank you for it.)but it is more 'professional' to drag in the 'house' object, that loads every single room.

 

@rick:

thats true. the following models are being loaded. Id didn't want to make the topic endlessly long.

  • basement
  • hallwaydown
  • kitchen
  • livingroom
  • hallwayup
  • storageroom
  • bathroom
  • studyroom
  • bedroom
  • stair basement
  • stair hallway
  • railing
  • between floor up
  • between floor down

Link to comment
Share on other sites

ah... i see. you are using a dummy mesh/pivot, then deciding which rooms you want to load... so there is no specific base model that will be always there no matter which room/area you load? ok... i think i follow you now... I was under the impression that you were loading a house model then just trying to determine whether or not to load a basement...

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

Its frustrating, I'm at work now so I can't try out any of this stuff right now. It is a possibility (I thank you for it.)but it is more 'professional' to drag in the 'house' object, that loads every single room.

 

I hear ya man. I do a ton of visualizing of how things would be done when I'm at work.

 

I agree with the more 'professional' statement. If you drag a model named basement into your scene you wouldn't think it would create an entire house. Plus you could never just drag the basement model in with it creating the house if you just wanted the basement because that code to load the other models would be in there.

 

I'm not a fan of Thingoids required to have models to be able to move them around in the editor. It's a waste for more logical objects like the house you are making.

Link to comment
Share on other sites

I hear ya man. I do a ton of visualizing of how things would be done when I'm at work.

 

I agree with the more 'professional' statement. If you drag a model named basement into your scene you wouldn't think it would create an entire house. Plus you could never just drag the basement model in with it creating the house if you just wanted the basement because that code to load the other models would be in there.

 

I'm not a fan of Thingoids required to have models to be able to move them around in the editor. It's a waste for more logical objects like the house you are making.

 

You can control what gets loaded thru code/properties selection. The only reason using a dummy mesh makes any sense is because he apparently doesn't have a base model that will always be present no matter what room is loaded. I was thinking he had an actual house model, then he was just trying to determine if he wanted to load a basement as well. But his approach works with the way he has all of the things divided up... where there is no one specific model that will always be present.

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

But his approach works with the way he has all of the things divided up... where there is no one specific model that will always be present

 

I find that this is almost always the case when you start trying to make reusable Thingoids though, like the character Thingoid Victor and I are working on. Especially when they are logical Thingoids. Having logical Thingoids is one of the coolest things about this whole lua implementation I think. It's object oriented programming at it's best. The plug and play ability of these is amazing, but the logical Thingoids still require a model in the editor which kind of stinks. It increases the load time since it has to load a dummy model which isn't used and does cause collision issues sometimes if you aren't careful. If you don't make anything a child of that dummy model you can hide it when you run in game mode which is a solution, but in his case if he makes the dummy model the parent and these other room models the children, if he hides the dummy model it'll hide all the rooms also. That's why I suggested just positioning them in the update method. Or I guess when in game mode he could unparent them and then hide it, then parent again when back in editor mode. You just wouldn't want that extra mesh and body hanging around when in game mode driving down your FPS if you have a ton of them. In this case it's only 1, but in my case where everything is a Thingoid, logic and all, you'll end up with a ton of them.

Link to comment
Share on other sites

self.basement works just fine (even though self refers to class in this case)... but the parent needs to be object.model...

Well it works now. Everyone thank you for helping. The script for every room was okay, it was just the self.model that needed to change in object.model

 

This is the final script that completely works. If you have any suggestions on how to do this even better, let me know.

require("scripts/class")

local class=CreateClass(...)

function class:CreateObject(model)
local object=self.super:CreateObject(model)

--Load all the rooms
	--rooms
	self.basement=LoadModel	        ("abstract::matt_house_basement.gmf")
	self.kitchen=LoadModel		("abstract::matt_house_kitchen.gmf")
	self.livingroom=LoadModel	("abstract::matt_house_livingroom.gmf")
	self.hallwaydown=LoadModel	("abstract::matt_house_hallwaydown.gmf")
	self.hallwayup=LoadModel	("abstract::matt_house_hallwayup.gmf")
	self.storage=LoadModel		("abstract::matt_house_storage.gmf")
	self.bedroom=LoadModel		("abstract::matt_house_bedroom.gmf")
	self.studyroom=LoadModel	("abstract::matt_house_studyroom.gmf")
	self.bathroom=LoadModel	        ("abstract::matt_house_bathroom.gmf")

	--stairs
	self.stairs_basement=LoadModel	("abstract::matt_house_stair-basement.gmf")
	self.stairs_hallway=LoadModel	("abstract::matt_house_stair-hallway.gmf")
	self.stairs_flipped=LoadModel	("abstract::matt_house_stair-flipped.gmf")

	--stairs
	self.railing=LoadModel		("abstract::matt_house_parts_railing.gmf")
	self.floor_up=LoadModel	        ("abstract::matt_house_parts_tussenvloer-boven.gmf")
	self.floor_down=LoadModel	("abstract::matt_house_parts_tussenvloer-onder.gmf")
	self.stairs_ending=LoadModel	("abstract::matt_house_parts_wall-end-stairs.gmf")
	self.stairs_side=LoadModel	("abstract::matt_house_parts_wall-side-stairs.gmf")	
--Done loading all the rooms


--parent objects to the house
	--rooms
	self.basement:SetParent	        (object.model)
	self.kitchen:SetParent		(object.model)
	self.livingroom:SetParent	(object.model)
	self.hallwaydown:SetParent	(object.model)
	self.hallwayup:SetParent	(object.model)
	self.storage:SetParent		(object.model)
	self.bedroom:SetParent		(object.model)
	self.studyroom:SetParent	(object.model)
	self.bathroom:SetParent         (object.model)

	--stairs
	self.stairs_basement:SetParent	(object.model)
	self.stairs_hallway:SetParent	(object.model)
	self.stairs_flipped:SetParent	(object.model)

	--parts
	self.railing:SetParent		(object.model)
	self.floor_up:SetParent	        (object.model)
	self.floor_down:SetParent	(object.model)
	self.stairs_ending:SetParent	(object.model)
	self.stairs_side:SetParent	(object.model)
--done with parenting


function object:Free(model)
	self.super:Free()
end

end

Link to comment
Share on other sites

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.

 Share

×
×
  • Create New...