Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Clone Object not working with LoadObjectWithChildren()

Author
Message
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 5th Apr 2017 19:56 Edited at: 5th Apr 2017 19:57
There's already a couple of posts regarding this from over a year ago:

https://forum.thegamecreators.com/thread/216295
and
https://forum.thegamecreators.com/thread/217186

The model is attached.

Attachments

Login to view attachments
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 8th Apr 2017 17:37
What's the current way of getting bugs reported / acknowledged?
JosephB
18
Years of Service
User Offline
Joined: 12th Sep 2006
Location:
Posted: 9th Apr 2017 09:20
CloneObject works for me. I could not use your model as there does not seem to be anything there in the X file. I have noticed that sometimes I have to work on the models in Fragmotion and then export back to the X format.

When I use the clonemodel I set everything with the object before cloning the model including texturing and then clone. I set up the difference after that such as position and animations.
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 9th Apr 2017 11:48
Not sure how you aren't able to see the model, as it's the one I'm using just fine. I just double checked it and loading it with LoadObjectWithChildren() does work.
I also tried the workaround suggested in one of the above posts. I have read that this is not a new fault and had already been fixed.

I've tried a LOT of model programs and converters (thought I'd tried the trial version of Fragmotion as well) and although the model loads and animations are present, cloning or instancing fails.


Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 10th Apr 2017 09:28
This fails for me:
CloneObject(obj2, obj1)

But this seems to work:
obj2 = CloneObject(obj1)
AGK V2 user - Tier 1 (mostly)
JosephB
18
Years of Service
User Offline
Joined: 12th Sep 2006
Location:
Posted: 10th Apr 2017 12:35
I am able to load your model into AGK2, but when I test for meshes the number shows as zero. When I load the model in Fragmotion, the mesh does not show. Sorry as I wish I could be more helpful. I have some X models that I have instanced and cloned in AGK2 and it seems to work fine. When they do not, I work with them in Fragmotion and try to get them to work. AGK2 is challenging as I have some models with only two meshes and when I texture (one texture for the model) them with after LoadObjectWithChildren, they will not texture properly. Still trying to figure that one.
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 11th Apr 2017 14:17
I think I've found the cause of this, CloneObject only clones the primary object, it doesn't clone the child objects. So you would have to go through the child objects and clone them all separately, then attach each one to the bones of the cloned parent with FixObjectToBone. I'll see if I can add a command that will clone everything, including the children.
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 11th Apr 2017 20:37
Hi Paul, thanks.
Interesting - I'll see if that works, as I think I tired something similar, but the animation wasn't working on the clone.
I might have broken it as I think I tried to assign the original children straight into the auto allocated (cloned) children
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 11th Apr 2017 22:02 Edited at: 11th Apr 2017 22:04
Update:

Yes, Paul your suggestion works. Even though it's a right pain, it does work.. phew. Thanks for that.

Quote: "I am able to load your model into AGK2, but when I test for meshes the number shows as zero. When I load the model in Fragmotion, the mesh does not show. Sorry as I wish I could be more helpful. I have some X models that I have instanced and cloned in AGK2 and it seems to work fine. When they do not, I work with them in Fragmotion and try to get them to work. AGK2 is challenging as I have some models with only two meshes and when I texture (one texture for the model) them with after LoadObjectWithChildren, they will not texture properly. Still trying to figure that one.
"


@Joseph
I tried Fragmotion again and I can see why it's different. My exported .X model has 0 meshes but 6 children. The fragmotion exported .X has 6 meshes (well, 15 including all the nulls and stuff) but no children. It does clone, but all my children had separate UVs which could explain your problem? If there are children, you need to texture (UV map) them separately and apply the texture to all child objects, else use setObjectMeshTexture on the individual meshes instead.

Login to post a reply

Server time is: 2024-11-24 16:22:06
Your offset time is: 2024-11-24 16:22:06