You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to know the process or a suggestion on how to create an empty father entity. I'm creating a card game, and since I made an extra object to simulate shadows, I need a father container so I can animate it without having extensive loops/arrays animating in sync the cards and their shadows. I'm going to try create an entity without desc, but not hoping to succeed on this, so if you could spare some of your time to help, would be much appreciated!
Update:
I was able to create the empty entity, and add the childrens, but I have a bug: whenever I apply a rotation in any axis, the children rotate on their own pivots. Any Idea why this is happening?
a snippet of code of what I'm doing to rotate: if(entitycardsarray[0] !== null){ entitycardsarray[0].onScene(function (){ entitycardsarray[0].translateZ(0.0001).rotateZ(-Math.PI*0.00000045); }); }
and then the way I create the card container and push childrens:
` function drawcard()
{
var empty = Phoria.Entity.create({
points: [ {x:0,y:0,z:0} ],
style : {
drawmode: "point",
shademode: "callback",
geometrysortmode: "none",
objectsortmode: "front" // force render on-top of everything else
}
});
var c = Phoria.Util.generateUnitCustomCube(1,0.001,2);
var d = Phoria.Util.generateUnitCustomCube(1,0.001,2);
// var c = Phoria.Util.generateUnitCustomCube(3,1,7);
var cube = Phoria.Entity.create({
points: c.points,
edges: c.edges,
polygons: c.polygons,
style: {
color: [255,255,255],
diffuse: 1.5,
specular: 16,
emit: -1,
texture: 0
}
});
var shadowcube = Phoria.Entity.create({
points: d.points,
edges: d.edges,
polygons: d.polygons,
style: {
color: [10,10,10],
drawmode: "solid",
shademode: "plain",
opacity: 0.4
}
});
shadowcube.translateY(-1);
shadowcube.translateX(0.4);
shadowcube.translateZ(-0.6);
Hi,
I would like to know the process or a suggestion on how to create an empty father entity. I'm creating a card game, and since I made an extra object to simulate shadows, I need a father container so I can animate it without having extensive loops/arrays animating in sync the cards and their shadows. I'm going to try create an entity without desc, but not hoping to succeed on this, so if you could spare some of your time to help, would be much appreciated!
Update:
I was able to create the empty entity, and add the childrens, but I have a bug: whenever I apply a rotation in any axis, the children rotate on their own pivots. Any Idea why this is happening?
a snippet of code of what I'm doing to rotate:
if(entitycardsarray[0] !== null){ entitycardsarray[0].onScene(function (){ entitycardsarray[0].translateZ(0.0001).rotateZ(-Math.PI*0.00000045); }); }
and then the way I create the card container and push childrens:
` function drawcard()
{
var empty = Phoria.Entity.create({
points: [ {x:0,y:0,z:0} ],
style : {
drawmode: "point",
shademode: "callback",
geometrysortmode: "none",
objectsortmode: "front" // force render on-top of everything else
}
});
var c = Phoria.Util.generateUnitCustomCube(1,0.001,2);
var d = Phoria.Util.generateUnitCustomCube(1,0.001,2);
// var c = Phoria.Util.generateUnitCustomCube(3,1,7);
var cube = Phoria.Entity.create({
points: c.points,
edges: c.edges,
polygons: c.polygons,
style: {
color: [255,255,255],
diffuse: 1.5,
specular: 16,
emit: -1,
texture: 0
}
});
var shadowcube = Phoria.Entity.create({
points: d.points,
edges: d.edges,
polygons: d.polygons,
style: {
color: [10,10,10],
drawmode: "solid",
shademode: "plain",
opacity: 0.4
}
});
shadowcube.translateY(-1);
shadowcube.translateX(0.4);
shadowcube.translateZ(-0.6);
cube.textures.push(cardmaps[0]);
cube.textures.push(cardmaps[1]);
cube.polygons[4].texture = 1;
cube.polygons[5].texture = 0;
empty.children.push(cube);
empty.children.push(shadowcube);
entitycardsarray.push(empty);
scene.graph.push(empty);
} `
thanks in advance
The text was updated successfully, but these errors were encountered: