Jump to content

NodeReference edit in code


photo

Recommended Posts

image.thumb.png.f5dc408e0e2aed90dc7454d4a92d2bb6.png

When I move the NodeReference object, the real reference object (getReference ()) changes too.

When I move 2 on the x axis of NodeReference, both the NodeReference and getReference () objects have an x value of 2.

However, a total of 2 moved, not 4 moved.
In the Editor, if both the NodeReference and getReference () objects move the x axis by 2, the result is a 4 moved.

I think I know something wrong, but please answer me.

Why does it look like it moved 2 spaces instead of 4 on the screen?

and What is the conversion method that does not affect real reference objects?

image.thumb.png.34cc9be03f5d2b804d631b6243aac335.png

 

And I get this error when I exit the program by just pressing x.

An error occurs only when the real reference object of .node for make NodeReference has an property with a component system applied.

image.png.33a8c0b17f3252e9dc66d10977f20749.png

What's wrong with the code?

 

Edited by dongju.jeong
Link to comment

Hi Dongju,

As for node reference transforms, it's normal behavior (described here).

Your code is ok, the error you get is due to a bug in the Component System, the fix will be available with the upcoming SDK release.

We're sorry for the inconvenience caused!

Thank you!

Link to comment

If the nodeReference in the world standard (0,0,0) moves by 2 distances on the x axis, the x value of the actual reference object is also set to 2.
When I restart after using the world :: get () -> saveNode () function, the nodeReference will be in world standard (2,0,0) from scratch even if it is not moved.

This causes an unwanted position shift, in addition to the direct modification of the actual reference object.

After add fuction "World :: get () -> saveNode (node_ref-> getNodeName (), node_ref-> getReference ())"  on the attached project; , you can see that the material_ball of the nodeReference moves sideways each time you rerun.

 

Is there a way that the actual reference object (getReference () Node) will not be affected about modifications to the NodeReference Node?

Link to comment

Hi, Dongju,

As Fox said earlier, it is expected behaviour, since the actual reference object keeps the transformation matrix of the NodeReference object. That is why on World::get()->saveNode(...) the reference object changes its position in your sample.

As a brief solution, you can reset the position of the reference object before the saving and move the node again.


	node_ref->getReference()->setWorldPosition(Vec3::ZERO);

	World::get()->saveNode(node_ref->getNodeName(), node_ref->getReference());

	node_ref->setPosition(Vec3(2, 0, 0));

We will consider improving this approach and the saveNode method in further releases. Sorry for the inconvenience.

Thanks!

Link to comment
×
×
  • Create New...