Cocos Forums
2,358 FOLLOWERS
Cocos Creator is a unified package of game development tools. Their forum holds discussions on extensions, developer interviews, documentations, game demos, editor tools, collaborations and other generic announcements.
Cocos Forums
43m ago
This piece of content is not open sourced
hossainiir:
*.scene 和 *.prefab ..read more
Cocos Forums
43m ago
Processing: image.png…
Processing: image.png…
hossainiir:
I don’t have any reference to the Component’s members!
This should be what you want ..read more
Cocos Forums
43m ago
Maybe I see what you mean. My English is terrible. Sorry.
cocos does not give a node a way to fetch all components, but you can try node[’_components’] to fetch all components ..read more
Cocos Forums
43m ago
Like this, this create a red picture.
start() {
let spriteFrame = new SpriteFrame();
spriteFrame.texture = this.createTexture();
let sp = this.getComponent(Sprite);
sp.spriteFrame = spriteFrame;
}
createTexture(){
let texture = new Texture2D();
texture.reset({
width: 2,
height: 2,
format: Texture2D.PixelFormat.RGBA8888
});
let data = new Int8Array([
255,0,0,255,
255,0,0,255,
255,0,0,255,
255,0,0,255,
]);
texture.upload ..read more
Cocos Forums
2h ago
this is how I get the data
audioSource.getPCMData(0).then(dataView => {
if (!dataView) return;
for (let i = 0; i < dataView.length; ++i) {
console.log('data: ' + dataView.getData(i));
}
});
in the console I get this data
-0.000030517578125
0
0.000030518509447574615
-0.000030517578125
0
0.000030518509447574615
-0.000030517578125
I put the data in an array
this.amplitudes.push(dataView.getData(i));
this is what is in the array
[
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0 ..read more
Cocos Forums
2h ago
You can set angular factor of rigidbody to (0,0,0) to freeze rotation ..read more
Cocos Forums
2h ago
You mean create texture from pixel data like [[255,255,255,255],[128,123,123,123 ..read more