Jump to content

Parenting not Working on Script but in Console it does


Pryme8
 Share

Recommended Posts

So for this: 
I have tried a bunch of different way to move the lines with the tiles.
Initially I thought maybe parenting was not working but it seems it is when I translate the tile through the console.

http://pryme8.github.io/TSO/ <- anywhere on the script even after the TSO object is created and I loop through the meshs changing their position it seems like the parenting is not working.
VS
http://pryme8.github.io/TSO/index2.html
Where if you go into the console and do like "tso.deck[0].mesh.position.x = 2;"  that will move the tile and the lines as expected.

What the heck?

Link to comment
Share on other sites

On that version the first three are the only ones with lines so far.  Ive got 12 done, but have not uploaded it yet.

And yeah  tso.deck[0].mesh.position.x = 2; is the correct thing thanks for that catch on my post.

example.thumb.png.1cb8a6010435f4c1e5f75be7e773919c.png

works as expected in console.
*EDIT**
I just updated index2 so you can paste:
for(var i=0; i<tso.deck.length; i++){tso.deck.mesh.position.x=i;}
 

into the console and it should move the tiles as expected with parenting.

but if I do this anywhere but in the console the parenting does not work.

Link to comment
Share on other sites

so, want to show when it is not working? the tso object is not referenced anywhere in your code. So, nowhere can we see what isn't working. The console is working, but this is the only thing we can do.

Also, as always, would be great to have this isolated in the playground (if you feel like it is a bug).

Link to comment
Share on other sites

5 hours ago, RaananW said:

so, want to show when it is not working? the tso object is not referenced anywhere in your code. So, nowhere can we see what isn't working. The console is working, but this is the only thing we can do.

Also, as always, would be great to have this isolated in the playground (if you feel like it is a bug).

I had that up for a while, I moved on and to a new version.  I can upload an example one again when I get to work today.

And it was in the actual TSO object that it was not working or anywhere else on the script for that matter  I had it running after the creating of the TSO object :
https://github.com/Pryme8/Pryme8.github.io/blob/9b93d5f66903fcb5d759753c8665a6ffbb4899c9/TSO/index.html#L1775

and when the tile was created as well even though in this version it shows it commented out:
https://github.com/Pryme8/Pryme8.github.io/blob/a2811e78a93155a799b14e373400fa5dff7f4bc0/TSO/index.html#L82

Ill keep an working broken example up here when I get a chance.


***UPDATE***
http://pryme8.github.io/TSO/

should have the example now.  Odd thing is it looks like it is working sometimes while others it does not, if you keep refreshing you may see the behavior.  Maybe I just need to wrap it in a timeout and see if its a timing issue.

Link to comment
Share on other sites

7 minutes ago, Pryme8 said:

Actually I can say with almost certainty its a timing issue... now that I see that behavior.  

Sooo solved I guess?

Still kinda odd cause the parenting should of happened way before I call the positioning but hey whatever.

I just noticed that on my local version it only works sometimes, so it really does seem to be a timing issue. But it doesn't happen on the stable version from what I've seen:

https://cdn.babylonjs.com/babylon.js

Link to comment
Share on other sites

I refreshed a few times and didn't see any different behavior, thou I don't know what the actual behavior should be.

Setting this aside, look at the waterfall of network loads:

image.thumb.png.841b8354b3a71ee65d726d2177786c2c.png

The red arrow is just there to show that there are 12 whole seconds (!) of computation. What is so complex that it blocks the entire execution for 12 whole seconds? I would say this is your problem.

Link to comment
Share on other sites

4 hours ago, RaananW said:

I refreshed a few times and didn't see any different behavior, thou I don't know what the actual behavior should be.

Setting this aside, look at the waterfall of network loads:

image.thumb.png.841b8354b3a71ee65d726d2177786c2c.png

The red arrow is just there to show that there are 12 whole seconds (!) of computation. What is so complex that it blocks the entire execution for 12 whole seconds? I would say this is your problem.

thats from the textures being generated, later ill do that in async so it wont be an issue.

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.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...