awe-media / awe.js

Create web-based AR, VR, interactive 360° experiences and more.
https://awe.media
339 stars 71 forks source link

Change text of an object #48

Closed 1260811 closed 5 years ago

1260811 commented 7 years ago

Hi, I'm using a text object and I want to change the word from one to two like it is was counting, it´s possible? I tried using awe.projection.update() function but it doesn't work.

awe-media commented 7 years ago

Hi @1260811 we'll add a feature request to make this work with update() in an upcoming release. But in the meantime you can do this directly using code like this.

var projection_child = awe.projections.view('s').get_mesh().children[0];
var projection_params = projection_child.geometry.parameters.parameters;
projection_child.geometry = new THREE.TextGeometry( "YOUR NEW TEXT HERE", projection_params );
awe.scene_needs_rendering = 1;

We'll leave this issue open in case anyone else needs this workaround in the meantime.

1260811 commented 7 years ago

does it work using a marker recognition?

awe-media commented 7 years ago

This is a separate question, but just add a listener for the 'ar_tracking_marker' event that is thrown when the tracking runs - see the source code here https://github.com/awe-media/awe.js/blob/master/examples/marker_ar/awe.marker_ar.js#L416

Inside your listener you can add the code shown above to create what you want.

1260811 commented 7 years ago

Thank you, but I'm begginer and I don't know where I must add it, could you write a example?

awe-media commented 5 years ago

This github repos is now focused on supporting the development of apps using awe.js on the awe.media platform. You can still access our older awe.js library as the deprecated branch, however we no longer support that code.