Is there a way to reset CSS2D Position?


Just asking if it’s possible to reset the location of the css2d div element?
I have a div element text that’s following a sphere object. The sphere rotates at its own but when the div element is behind the sphere, it’s still visible. My option is to reset it the text position to its original. It still follows the sphere during rotation but when its visible is set to true, then I want to reset it back to original position.

companyNotes.position.set(0, 1, 1)

Any help?

How about creating a new property in userData and then save the position for the restore?

 // do this once to create the new custom field
companyNotes.userData.originalPosition = new THREE.Vector3();

// save
companyNotes.userData.originalPosition.copy( companyNotes.position );

// restore
companyNotes.position.copy( companyNotes.userData.originalPosition );
1 Like